Created
September 19, 2017 00:38
-
-
Save joshua/33794cb0a00e0346e8ae7eda63e8270c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
find_files() { | |
find . -not \( \ | |
\( \ | |
-wholename '*/vendor/*' \ | |
\) -prune \ | |
\) -name '*.go' | |
} | |
GOFMT="gofmt -s" | |
bad_files=$(find_files | xargs $GOFMT -l) | |
if [[ -n "${bad_files}" ]]; then | |
echo "!!! '$GOFMT' needs to be run on the following files: " | |
echo "${bad_files}" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment