| 1 |
TEST?=./... |
| 2 |
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr |
| 3 |
|
| 4 |
default: test |
| 5 |
|
| 6 |
|
| 7 |
test: |
| 8 |
ACD_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4 |
| 9 |
@$(MAKE) fmt |
| 10 |
@$(MAKE) vet |
| 11 |
|
| 12 |
|
| 13 |
testacc: |
| 14 |
@if [ "$(TEST)" = "./..." ]; then \ |
| 15 |
echo "ERROR: Set TEST to a specific package"; \ |
| 16 |
exit 1; \ |
| 17 |
fi |
| 18 |
ACD_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m |
| 19 |
|
| 20 |
|
| 21 |
testrace: |
| 22 |
ACD_ACC= go test -race $(TEST) $(TESTARGS) |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
updatedeps: |
| 27 |
@gpm |
| 28 |
|
| 29 |
cover: |
| 30 |
@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \ |
| 31 |
go get -u golang.org/x/tools/cmd/cover; \ |
| 32 |
fi |
| 33 |
go test $(TEST) -coverprofile=coverage.out |
| 34 |
go tool cover -html=coverage.out |
| 35 |
rm coverage.out |
| 36 |
|
| 37 |
|
| 38 |
fmt: |
| 39 |
@go list ./... \ |
| 40 |
| xargs go fmt |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
vet: |
| 45 |
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \ |
| 46 |
go get golang.org/x/tools/cmd/vet; \ |
| 47 |
fi |
| 48 |
@go list -f '{{.Dir}}' ./... \ |
| 49 |
| xargs go tool vet ; if [ $$? -eq 1 ]; then \ |
| 50 |
echo ""; \ |
| 51 |
echo "Vet found suspicious constructs. Please check the reported constructs"; \ |
| 52 |
echo "and fix them if necessary before submitting the code for reviewal."; \ |
| 53 |
fi |
| 54 |
|
| 55 |
.PHONY: default test vet |