From fbf9732a7a7a599fdc35b7e9e2072d32d2ea9d33 Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Sat, 30 Oct 2021 00:31:39 -0300 Subject: goimports --- .githooks/pre-commit | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.githooks/pre-commit') 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 -- cgit v1.2.3