pre-commit: Check gofmt output for errors

gofmt doesn't return an error exit code when it fails (because some
files are improperly formatted). Make sure that the output is empty
instead.
This commit is contained in:
Antoine Pelisse
2018-01-16 09:15:55 -08:00
parent aad4b1b328
commit 9344d3610a

View File

@@ -15,7 +15,7 @@ go_dirs() {
}
echo "Running go fmt"
go_dirs | xargs -0 gofmt -s -d -l
diff <(echo -n) <(go_dirs | xargs -0 gofmt -s -d -l)
rc=$((rc || $?))
echo "Running goimports"