-
Notifications
You must be signed in to change notification settings - Fork 5
/
makefile
40 lines (32 loc) · 1.07 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
version=0.1.0
_allpackages = $(shell go list ./...)
# memoize allpackages, so that it's executed only once and only if used
allpackages = $(if $(__allpackages),,$(eval __allpackages := $$(_allpackages)))$(__allpackages)
.PHONY: all
all:
@echo "make <cmd>"
@echo ""
@echo "commands:"
@echo " build - build the source code"
@echo " lint - lint the source code"
@echo " test - test the source code"
@echo " fmt - format the code with gofmt"
@echo " install - install dependencies"
lint:
@go vet $(allpackages)
@golint $(allpackages)
test:
@ginkgo -r -cover -covermode=count
@rm -rf "coverage" && mkdir "coverage"
@find . -name "*.coverprofile" | xargs gocovmerge > "coverage/coverage.out"
@find . -name "*.coverprofile" -type f -delete
@go tool cover -html="coverage/coverage.out" -o "coverage/coverage.html"
fmt:
@go fmt $(allpackages)
build: lint
@go build $(allpackages)
install:
@go get -u github.com/golang/lint/golint
@go get -u github.com/onsi/ginkgo/ginkgo
@go get -u github.com/wadey/gocovmerge
@go mod vendor