Enforce `go fmt` is clean in the test run.

Adds a routine to test.sh to ensure committers have run `go fmt` before submission.
This commit is contained in:
J.C. Jones 2015-05-12 09:01:00 -07:00
parent 221e19d232
commit 39a61774e7
1 changed files with 11 additions and 0 deletions

11
test.sh
View File

@ -63,4 +63,15 @@ else
run go test ${dirlist}
fi
echo "Checking for unformatted files:"
unformatted=$(find . -name "*.go" -not -path "./Godeps/*" -print | xargs -n1 gofmt -l)
if [ "x${unformatted}" != "x" ] ; then
echo "Unformatted files found; setting failure state."
echo "Please run 'go fmt' on each of these files and amend your commit to continue."
FAILURE=1
for f in ${unformatted}; do
echo "- ${f}"
done
fi
exit ${FAILURE}