Skip to content

Commit

Permalink
refactor: add make lint git hook (#19075)
Browse files Browse the repository at this point in the history
  • Loading branch information
levisyin authored Jan 23, 2024
1 parent 7685abb commit ad04bfe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ benchmark:

golangci_version=v1.55.0

#? setup-pre-commit: Set pre-commit git hook
setup-pre-commit:
@cp .git/hooks/pre-commit .git/hooks/pre-commit.bak 2>/dev/null || true
@echo "Installing pre-commit hook..."
@ln -sf ../../scripts/hooks/pre-commit.sh .git/hooks/pre-commit
@echo "Pre-commit hook installed successfully"

#? lint-install: Install golangci-lint
lint-install:
@echo "--> Installing golangci-lint $(golangci_version)"
Expand Down
4 changes: 4 additions & 0 deletions scripts/hooks/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# lint modified go files
golangci-lint run --fix --new -c .golangci.yml

0 comments on commit ad04bfe

Please sign in to comment.