diff options
-rw-r--r-- | Makefile.util.mk | 2 | ||||
-rwxr-xr-x | _support/validate-formatting.sh | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Makefile.util.mk b/Makefile.util.mk index 8a36d805..80ca63b1 100644 --- a/Makefile.util.mk +++ b/Makefile.util.mk @@ -3,7 +3,7 @@ verify: list fmt vet lint complexity fmt: bin/goimports .GOPATH/.ok - $Q @./bin/goimports -local $(IMPORT_PATH) -l $(allfiles) | awk '{ print } END { if (NR>0) { print "Please run ./bin/goimports -w -local $(IMPORT_PATH) -l $(allfiles)"; exit 1 } }' + $Q @_support/validate-formatting.sh $(allfiles) vet: .GOPATH/.ok $Q go vet $(allpackages) diff --git a/_support/validate-formatting.sh b/_support/validate-formatting.sh new file mode 100755 index 00000000..38f54661 --- /dev/null +++ b/_support/validate-formatting.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eu + +IMPORT_RESULT=$(./bin/goimports -e -local "gitlab.com/gitlab-org/gitlab-pages" -l "$@") + +if [ -n "${IMPORT_RESULT}" ]; then + echo >&2 "Please run ./bin/goimports -w -local gitlab.com/gitlab-org/gitlab-pages -l $@" + echo "${IMPORT_RESULT}" + exit 1 +fi |