Skip to content

Instantly share code, notes, and snippets.

@flavianmissi
Created May 7, 2012 14:48
Show Gist options
  • Save flavianmissi/2628184 to your computer and use it in GitHub Desktop.
Save flavianmissi/2628184 to your computer and use it in GitHub Desktop.
Git hook to run gofmt -w . before commiting
gofmt -w .
if [ "$(git diff --diff-filter M --name-only)" == "$(git diff --cached --name-only)" ];
then
echo "There's gofmt alterations to be commited."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment