Last active
April 16, 2024 03:03
-
-
Save ozars/444f96529d0bb947ec1198f8c836bb85 to your computer and use it in GitHub Desktop.
go format precommit
This file contains hidden or 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/bash -xe | |
for f in `git diff --name-only --cached --diff-filter=AM`; do | |
if [[ $f == *.go ]]; then | |
gofmt -w $f | |
git add $f | |
fi | |
done | |
# vim: set sts=2 ts=2 sw=2 et ft=bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment