aboutsummaryrefslogtreecommitdiff
path: root/.githooks
diff options
context:
space:
mode:
Diffstat (limited to '.githooks')
-rwxr-xr-x.githooks/pre-commit6
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