Skip to content

Commit 64f77c0

Browse files
author
zhouhao
committed
Makefile: add gofmt to test
Signed-off-by: zhouhao <[email protected]>
1 parent 83850e8 commit 64f77c0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,17 @@ lint:
5959
@echo "checking lint"
6060
@./.tool/lint
6161

62-
test:
63-
go test -v -race -cover $(shell go list ./... | grep -v /vendor/)
62+
.PHONY: .gofmt .gotest
63+
64+
PACKAGES = $(shell go list ./... | grep -v /vendor/)
65+
test: .gofmt .gotest
66+
67+
FILES = $(shell find ./ -name *.go | grep -v vendor)
68+
.gofmt:
69+
OUT=$$(gofmt -s -d $(FILES)); if test -n "$${OUT}"; then echo "$${OUT}" && exit 1; fi
70+
71+
.gotest:
72+
go test -v -race -cover $(PACKAGES)
6473

6574

6675
## this uses https://github.com/Masterminds/glide and https://github.com/sgotti/glide-vc

0 commit comments

Comments
 (0)