Makefile: add vet target
This commit is contained in:
parent
3165b0c936
commit
ffd570fe3c
15
Makefile
15
Makefile
|
@ -1,4 +1,6 @@
|
|||
TEST?=./...
|
||||
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
|
||||
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
|
||||
|
||||
default: test
|
||||
|
||||
|
@ -10,6 +12,7 @@ dev:
|
|||
|
||||
test:
|
||||
go test $(TEST) $(TESTARGS) -timeout=10s
|
||||
@$(MAKE) vet
|
||||
|
||||
testrace:
|
||||
go test -race $(TEST) $(TESTARGS)
|
||||
|
@ -17,4 +20,14 @@ testrace:
|
|||
updatedeps:
|
||||
go get -d -v -p 2 ./...
|
||||
|
||||
.PHONY: bin default test updatedeps
|
||||
vet:
|
||||
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
|
||||
go get golang.org/x/tools/cmd/vet; \
|
||||
fi
|
||||
@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
|
||||
echo ""; \
|
||||
echo "Vet found suspicious constructs. Please check the reported constructs"; \
|
||||
echo "and fix them if necessary before submitting the code for reviewal."; \
|
||||
fi
|
||||
|
||||
.PHONY: bin default test updatedeps vet
|
||||
|
|
Loading…
Reference in New Issue