diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 231de300..edf3eaa8 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -52,17 +52,8 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: go.mod - - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.63 - - # Optional: golangci-lint command line arguments. - args: --config=.golangci.yml - - # actions/setup-go already handles caching - skip-cache: true + - name: run golangci-lint + run: make golangci-lint govulncheck: name: govulncheck diff --git a/Makefile b/Makefile index 08705e48..af27e721 100644 --- a/Makefile +++ b/Makefile @@ -133,13 +133,17 @@ test: manifests generate fmt vet envtest ## Run tests. test-e2e: go test ./test/e2e/ -v -ginkgo.v -.PHONY: lint -lint: golangci-lint ## Run golangci-lint linter & yamllint - $(GOLANGCI_LINT) run + +.PHONY: golangci-lint-fix +golangci-lint-fix: $(GOLANGCI_LINT) ## Run the golangci-lint linter and perform fixes + @$(GOLANGCI_LINT) --config=.golangci.yml -verbose run --fix + + +.PHONY: lint +lint: golangci-lint ## Run various linters .PHONY: lint-fix -lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes - $(GOLANGCI_LINT) run --fix +lint-fix: golangci-lint-fix ## run linters and perform fixes ##@ Build @@ -247,7 +251,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION) KUSTOMIZE_VERSION ?= v5.3.0 CONTROLLER_TOOLS_VERSION ?= v0.14.0 ENVTEST_VERSION ?= release-0.17 -GOLANGCI_LINT_VERSION ?= v1.57.2 +GOLANGCI_LINT_VERSION ?= v1.63.4 .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. @@ -269,8 +273,9 @@ check-all-committed: ## Fail in case there are uncommitted changes test -z "$(shell git status --short)" || (echo "files were modified: " ; git status --short ; false) .PHONY: golangci-lint -golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. -$(GOLANGCI_LINT): $(LOCALBIN) +golangci-lint: $(GOLANGCI_LINT) ## Run the golangci-lint linter + @$(GOLANGCI_LINT) --config=.golangci.yml -verbose run +$(GOLANGCI_LINT): $(LOCALBIN) ## Download golangci-lint locally if necessary. $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION}) # go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist