Skip to content

Commit

Permalink
chore: add pre-commit&pre-push hooks via husky
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed May 17, 2024
1 parent 9c8cc17 commit ce4c9a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .husky/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

cd "$(dirname ${BASH_SOURCE})"/../..

gofmt -s -w .

# This could be a simple "goimports -w ." without find&grep, if only .goimportsignore would work on a per-project basis.
# See https://github.com/golang/go/issues/42965.
find . -iname \*.go | grep -v zz_generated.deepcopy.go | xargs goimports -w

git add --patch
9 changes: 9 additions & 0 deletions .husky/hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

cd "$(dirname ${BASH_SOURCE})"/../..

make
make lint
make test
make test-e2e

0 comments on commit ce4c9a8

Please sign in to comment.