From 64f77c0f78e52e8c18c85150a440134d730a4ced Mon Sep 17 00:00:00 2001 From: zhouhao Date: Wed, 19 Jul 2017 16:55:16 +0800 Subject: [PATCH 1/2] Makefile: add gofmt to test Signed-off-by: zhouhao --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 61d7a80..040fd68 100644 --- a/Makefile +++ b/Makefile @@ -59,8 +59,17 @@ lint: @echo "checking lint" @./.tool/lint -test: - go test -v -race -cover $(shell go list ./... | grep -v /vendor/) +.PHONY: .gofmt .gotest + +PACKAGES = $(shell go list ./... | grep -v /vendor/) +test: .gofmt .gotest + +FILES = $(shell find ./ -name *.go | grep -v vendor) +.gofmt: + OUT=$$(gofmt -s -d $(FILES)); if test -n "$${OUT}"; then echo "$${OUT}" && exit 1; fi + +.gotest: + go test -v -race -cover $(PACKAGES) ## this uses https://github.com/Masterminds/glide and https://github.com/sgotti/glide-vc From 3ace3abdc45763e404c982e130007568a54dc8f7 Mon Sep 17 00:00:00 2001 From: zhouhao Date: Mon, 14 Aug 2017 17:13:10 +0800 Subject: [PATCH 2/2] Makefile add govet to test Signed-off-by: zhouhao --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 040fd68..24369a0 100644 --- a/Makefile +++ b/Makefile @@ -59,15 +59,18 @@ lint: @echo "checking lint" @./.tool/lint -.PHONY: .gofmt .gotest +.PHONY: .gofmt .govet .gotest PACKAGES = $(shell go list ./... | grep -v /vendor/) -test: .gofmt .gotest +test: .gofmt .govet .gotest FILES = $(shell find ./ -name *.go | grep -v vendor) .gofmt: OUT=$$(gofmt -s -d $(FILES)); if test -n "$${OUT}"; then echo "$${OUT}" && exit 1; fi +.govet: + go vet -x $(PACKAGES) + .gotest: go test -v -race -cover $(PACKAGES)