Skip to content

Commit ee65f10

Browse files
Copilothzxuzhonghu
andcommitted
Use explicit golangci-lint version via Makefile instead of action
Co-authored-by: hzxuzhonghu <13374016+hzxuzhonghu@users.noreply.github.com>
1 parent 8956d6a commit ee65f10

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,4 @@ jobs:
3131
go-version: '1.24'
3232

3333
- name: Run golangci-lint
34-
uses: golangci/golangci-lint-action@v6
35-
with:
36-
version: latest
37-
# Optional: show only new issues if it's a pull request
38-
only-new-issues: false
39-
# Optional: if set to true then the action will use pre-installed Go
40-
skip-go-installation: true
34+
run: make lint

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ vet: ## Run go vet against code.
132132
go vet ./...
133133

134134
# Run linter
135-
lint:
136-
@echo "Running linter..."
137-
golangci-lint run ./...
135+
.PHONY: lint
136+
lint: golangci-lint ## Run golangci-lint
137+
$(GOLANGCI_LINT) run ./...
138138

139139
# Install to system
140140
install: build
@@ -273,15 +273,22 @@ $(LOCALBIN):
273273

274274
## Tool Binaries
275275
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
276+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
276277

277278
## Tool Versions
278279
CONTROLLER_TOOLS_VERSION ?= v0.17.2
280+
GOLANGCI_LINT_VERSION ?= v1.64.1
279281

280282
.PHONY: controller-gen
281283
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
282284
$(CONTROLLER_GEN): $(LOCALBIN)
283285
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
284286

287+
.PHONY: golangci-lint
288+
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
289+
$(GOLANGCI_LINT): $(LOCALBIN)
290+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
291+
285292
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
286293
# $1 - target path with name of binary
287294
# $2 - package url which can be installed

0 commit comments

Comments
 (0)