Skip to content

Instantly share code, notes, and snippets.

@ehashman
Created April 26, 2019 20:40
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 ehashman/730d1a108b98dcbb8333cbb327b752f3 to your computer and use it in GitHub Desktop.
Save ehashman/730d1a108b98dcbb8333cbb327b752f3 to your computer and use it in GitHub Desktop.
pre-commit hook to run gofmt
#!/bin/bash
#
# Save me as
# .git/hooks/pre-commit
if [[ -n `gofmt -s -l pkg cmd test` ]]; then
gofmt -s -d pkg cmd test
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment