Created
September 27, 2015 08:46
-
-
Save thehowl/01129664a0f61e73b58c to your computer and use it in GitHub Desktop.
pre-commit hook to automatically `go fmt` your changed go files
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/sh | |
git diff --name-only --cached | grep \.go | while read line | |
do | |
echo "hook : go fmt for $line..." | |
go fmt $line | |
git add $line | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment