Skip to content

Commit

Permalink
Merge pull request #195 from obnoxxx/rework-golangci-lint
Browse files Browse the repository at this point in the history
Rework golangci lint
  • Loading branch information
Madhu-1 authored Jan 15, 2025
2 parents f3cbbd2 + cf9a9f5 commit d9caee9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit d9caee9

Please sign in to comment.