summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2021-07-26 16:21:10 -0700
committerStan Hu <stanhu@gmail.com>2021-07-26 16:21:10 -0700
commit0997266fc03b0851e4ef52d25dbe8b44bdba7de7 (patch)
tree356c942bebe9e5cd9510c70574821cc81915a17f
parent1eadd3a61f3955354b4041fd284ba50e2a17864a (diff)
downloadgitlab-shell-0997266fc03b0851e4ef52d25dbe8b44bdba7de7.tar.gz
Make gofmt check fail if there are any matching files
gofmt doesn't return an exit code 1 if there are matching files: https://github.com/golang/go/issues/24230 To fix this, use the same trick we use in Workhorse to parse output. Also add a `make fmt` step to format all the code properly.
-rw-r--r--Makefile5
1 files changed, 4 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 88daed3..632c324 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,10 @@ validate: verify test
verify: verify_golang
verify_golang:
- gofmt -s -l $(GO_SOURCES)
+ gofmt -s -l $(GO_SOURCES) | awk '{ print } END { if (NR > 0) { print "Please run make fmt"; exit 1 } }'
+
+fmt:
+ gofmt -w -s $(GO_SOURCES)
test: test_ruby test_golang