Skip to content

Instantly share code, notes, and snippets.

@lcaballero
Created February 10, 2017 18:35
Show Gist options
  • Save lcaballero/9b58a68b730cc979de3dd1e37d9f9dab to your computer and use it in GitHub Desktop.
Save lcaballero/9b58a68b730cc979de3dd1e37d9f9dab to your computer and use it in GitHub Desktop.
A simple pre-commit hook to run go tests (with race flag)
#!/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