...
1VETTERS = "asmdecl,assign,atomic,bools,buildtag,cgocall,composites,copylocks,errorsas,httpresponse,loopclosure,lostcancel,nilfunc,printf,shift,stdmethods,structtag,tests,unmarshal,unreachable,unsafeptr,unusedresult"
2GOFMT_FILES = $(shell go list -f '{{.Dir}}' ./... | grep -v '/pb')
3
4fmtcheck:
5 @command -v goimports > /dev/null 2>&1 || go get golang.org/x/tools/cmd/goimports
6 @CHANGES="$$(goimports -d $(GOFMT_FILES))"; \
7 if [ -n "$${CHANGES}" ]; then \
8 echo "Unformatted (run goimports -w .):\n\n$${CHANGES}\n\n"; \
9 exit 1; \
10 fi
11 @# Annoyingly, goimports does not support the simplify flag.
12 @CHANGES="$$(gofmt -s -d $(GOFMT_FILES))"; \
13 if [ -n "$${CHANGES}" ]; then \
14 echo "Unformatted (run gofmt -s -w .):\n\n$${CHANGES}\n\n"; \
15 exit 1; \
16 fi
17.PHONY: fmtcheck
18
19spellcheck:
20 @command -v misspell > /dev/null 2>&1 || go get github.com/client9/misspell/cmd/misspell
21 @misspell -locale="US" -error -source="text" **/*
22.PHONY: spellcheck
23
24staticcheck:
25 @command -v staticcheck > /dev/null 2>&1 || go get honnef.co/go/tools/cmd/staticcheck
26 @staticcheck -checks="all" -tests $(GOFMT_FILES)
27.PHONY: staticcheck
28
29test:
30 @go test \
31 -count=1 \
32 -short \
33 -timeout=5m \
34 -vet="${VETTERS}" \
35 ./...
36.PHONY: test
37
38test-acc:
39 @go test \
40 -count=1 \
41 -race \
42 -timeout=10m \
43 -vet="${VETTERS}" \
44 ./...
45.PHONY: test-acc
View as plain text