Skip to content

Instantly share code, notes, and snippets.

@ozars
Last active April 16, 2024 03:03
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 ozars/444f96529d0bb947ec1198f8c836bb85 to your computer and use it in GitHub Desktop.
Save ozars/444f96529d0bb947ec1198f8c836bb85 to your computer and use it in GitHub Desktop.
go format precommit
#!/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