Created
February 10, 2017 18:35
-
-
Save lcaballero/9b58a68b730cc979de3dd1e37d9f9dab to your computer and use it in GitHub Desktop.
A simple pre-commit hook to run go tests (with race flag)
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 | |
git stash -q --keep-index | |
go test --race ./... | |
RESULT=$? | |
git stash pop -q | |
if [ $RESULT -ne 0 ] ; then | |
echo "pre-commit tests failed." | |
exit 1 | |
else | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment