diff options
author | KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> | 2021-10-30 00:31:39 -0300 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | fbf9732a7a7a599fdc35b7e9e2072d32d2ea9d33 (patch) | |
tree | 4a669e16690fdebf5f597f5bb9a229b888776e48 /.githooks | |
parent | 8040825daac4a5ba24e947c4c657d169d7763543 (diff) |
goimports
Diffstat (limited to '.githooks')
-rwxr-xr-x | .githooks/pre-commit | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 95fbb20..7fda0a3 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -7,6 +7,12 @@ STAGED="$(git diff --cached --name-only -- '*.go')" if [ -n "$STAGED" ]; then for file in $STAGED; do go fmt "$file" + + # run goimports if it's there + if command -v goimports >/dev/null 2>&1; then + goimports -w "$file" + fi + git add "$file" done fi |