refactor: add make lint git hook (#19075)

This commit is contained in:
levisyin
2024-01-23 09:43:14 +00:00
committed by GitHub
parent 7685abb885
commit ad04bfede0
2 changed files with 11 additions and 0 deletions
+7
View File
@@ -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)"
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
# lint modified go files
golangci-lint run --fix --new -c .golangci.yml