Merge pull request #828 from ceh/go-vet

Makefile: add vet target
This commit is contained in:
Mitchell Hashimoto 2015-01-16 13:30:13 -08:00
commit ef1f2d5e71
1 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,5 @@
TEST?=./...
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
default: test
@ -10,6 +11,7 @@ dev: generate
test: generate
TF_ACC= go test $(TEST) $(TESTARGS) -timeout=10s -parallel=4
@$(MAKE) vet
testacc: generate
@if [ "$(TEST)" = "./..." ]; then \
@ -26,10 +28,22 @@ updatedeps:
git symbolic-ref --short HEAD 2>/dev/null \
|| git rev-parse HEAD"))
go get -u golang.org/x/tools/cmd/stringer
go get -u golang.org/x/tools/cmd/vet
go get -f -u -v ./...
git checkout $(REF)
vet:
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
@echo "go tool vet $(VETARGS) ."
@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
generate:
go generate ./...
.PHONY: bin default generate test updatedeps
.PHONY: bin default generate test updatedeps vet