Last active
September 1, 2020 09:12
-
-
Save RollMan/8d44f007e5d3248093e8c7fdfea79501 to your computer and use it in GitHub Desktop.
golang_autoformat_git_commit.sh
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/sh | |
| # https://yoshinorin.net/2018/01/07/git-pre-commit-code-format/ | |
| for FILE in `git diff --staged --name-only --diff-filter=ACMRTUB | grep '.go$'`; do | |
| gofmt -w $FILE | |
| git add $FILE | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment