Skip to content

Instantly share code, notes, and snippets.

@laser
Created March 30, 2018 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laser/b665fc602ba8c82b6a75e62040285d38 to your computer and use it in GitHub Desktop.
Save laser/b665fc602ba8c82b6a75e62040285d38 to your computer and use it in GitHub Desktop.
A Git pre-commit hook
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
for FILE in $(git diff-index --name-only $against) ; do
# Check if the file contains Print
if grep 'Print' $FILE ; then
echo $FILE ' contains Print - ejecting'
exit 1
fi
done
go run ./build/*.go lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment