registry/hack/validate_gofmt.sh
Olivier Gambier 9fd57ab42b Test drone
2014-11-13 13:58:52 -08:00

18 lines
423 B
Bash
Executable file

#!/bin/bash
badFiles=($(find ./ -iname "*.go" -exec gofmt -s -l {} \;))
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! All Go source files are properly formatted.'
else
{
echo "These files are not properly gofmt'd:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
echo 'Please reformat the above files using "gofmt -s -w" and commit the result.'
echo
} >&2
false
fi