diff options
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 |