Debian Codegraph @

Makefile

raw
1 VENDOR := vendor
2 PKGS := $(shell go list ./... | grep -v /$(VENDOR)/)
3 SRC = $(shell find . -type f -name '*.go' -not -path "*/$(VENDOR)/*")
4 BIN_DIR := $(GOPATH)/bin
5 GOMETALINTER := $(BIN_DIR)/gometalinter
6
7 .PHONY: test
8 test: vet
9 go test $(PKGS)
10
11 $(GOMETALINTER):
12 go get -u github.com/alecthomas/gometalinter
13 $(GOMETALINTER) --install &> /dev/null
14
15 .PHONY: lint
16 lint: $(GOMETALINTER)
17 $(GOMETALINTER) ./... --vendor
18
19 .PHONY: fmt
20 fmt:
21 @gofmt -s -l -w $(SRC)
22
23 .PHONY: fmtcheck
24 fmtcheck:
25 @bash -c "diff -u <(echo -n) <(gofmt -d $(SRC))"
26
27 .PHONY: vet
28 vet:
29 go vet $(PKGS)
30
31 .PHONY: cover
32 cover:
33 $(shell [ -e coverage.out ] && rm coverage.out)
34 @echo "mode: count" > coverage-all.out
35 @$(foreach pkg,$(PKGS),\
36 go test -coverprofile=coverage.out -covermode=count $(pkg);\
37 tail -n +2 coverage.out >> coverage-all.out;)
38 go tool cover -html=coverage-all.out -o=coverage-all.html