31 lines
941 B
Makefile
31 lines
941 B
Makefile
golangci_version=v1.61.0
|
|
golangci_installed_version=$(shell golangci-lint version --format short 2>/dev/null)
|
|
|
|
#? 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:
|
|
ifneq ($(golangci_installed_version),$(golangci_version))
|
|
@echo "--> Installing golangci-lint $(golangci_version)"
|
|
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
|
|
endif
|
|
|
|
#? lint: Run golangci-lint
|
|
lint:
|
|
@echo "--> Running linter"
|
|
$(MAKE) lint-install
|
|
@./scripts/go-lint-all.bash --timeout=15m
|
|
|
|
#? lint: Run golangci-lint and fix
|
|
lint-fix:
|
|
@echo "--> Running linter"
|
|
$(MAKE) lint-install
|
|
@./scripts/go-lint-all.bash --fix
|
|
|
|
.PHONY: lint lint-fix
|