build(lint): pin golangci-lint v2.15.0 in the Makefile and lint through make in CI

This commit is contained in:
Julien Neuhart
2026-10-28 19:50:41 +01:00
parent 7ee3b7bb4d
commit 3123fbccde
3 changed files with 11 additions and 7 deletions

View File

@@ -232,7 +232,7 @@ join() {
# mode=max exports intermediate stages too, not just the final layers, which is
# what makes the expensive apt and jlink stages reusable. type=registry, not
# type=gha: the GitHub Actions cache is capped at 10 GB per repository and is
# already carrying the Go and golangci-lint caches that the lint and test jobs
# already carrying the Go caches that the lint and test jobs
# depend on. Multi-GB image layers across five platforms would evict them.
cache_flags() {
local target="$1"

View File

@@ -29,9 +29,7 @@ jobs:
go-version-file: go.mod
- name: Run linters
uses: golangci/golangci-lint-action@v9
with:
version: v2.15.0
run: make lint
lint-prettier:
name: Lint non-Golang codebase

View File

@@ -209,9 +209,15 @@ test-integration: ## Run integration tests (automatically retries failed scenari
--no-concurrency=$(NO_CONCURRENCY) \
--tags="$(TAGS)"
# golangci-lint runs at a pinned version, so a Homebrew upgrade cannot move the
# findings under the zero-warnings policy. An env var of the same name overrides
# it.
GOLANGCI_LINT_VERSION ?= v2.15.0
GOLANGCI_LINT = go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
.PHONY: lint
lint: ## Lint Golang codebase
golangci-lint run
$(GOLANGCI_LINT) run
.PHONY: lint-prettier
lint-prettier: ## Lint non-Golang codebase
@@ -219,7 +225,7 @@ lint-prettier: ## Lint non-Golang codebase
.PHONY: lint-todo
lint-todo: ## Find TODOs in Golang codebase
golangci-lint run --no-config --default=none --enable godox
$(GOLANGCI_LINT) run --no-config --default=none --enable godox
# TODO: restore a plain "go fix ./..." once the errorsastype modernizer stops
# rewriting this codebase into code that does not compile. Re-check by dropping
@@ -232,7 +238,7 @@ lint-todo: ## Find TODOs in Golang codebase
.PHONY: fmt
fmt: ## Format Golang codebase and "optimize" the dependencies
go fix -errorsastype=false ./...
golangci-lint fmt
$(GOLANGCI_LINT) fmt
go mod tidy
.PHONY: prettify