update makefile

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-05-09 15:11:17 +08:00
parent 7f168bd1cb
commit 95427edbba
No known key found for this signature in database
GPG Key ID: 0F84B2110C500B1F

View File

@ -31,12 +31,13 @@ all: build
.PHONY: fmt-check .PHONY: fmt-check
fmt-check: fmt-check:
# get all go files and run go fmt on them # get all go files and run go fmt on them
@files=$$($(GOFILES) | xargs $(GOFMT) -l); if [ -n "$$files" ]; then \ @diff=$$($(GOFMT) -d $(GOFILES)); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \ echo "Please run 'make fmt' and commit the result:"; \
echo "$${files}"; \ echo "$${diff}"; \
exit 1; \ exit 1; \
fi; fi;
fmt: fmt:
$(GOFMT) -w $(GOFILES) $(GOFMT) -w $(GOFILES)