Skip to content

Commit e7a7637

Browse files
authored
fix(make): install golangci-lint via v2 module path so make lint works (#600)
## Summary `Makefile`'s lint, lint-fix, and dev-setup targets pinned `github.com/golangci/golangci-lint/cmd/golangci-lint@latest` — the **v1** module path. Since the v2 release, `@latest` from this path resolves to the last v1.x tag (v1.64.8). The project's `.golangci.yml` uses `version: "2"`, so v1 errors out with: > Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2 CI was unaffected because `netresearch/.github`'s `go-check` workflow installs golangci-lint via a path that already targets v2. Only `make lint` was broken locally. Surfaced by [a review comment on #597](#597). ## Changes - `Makefile:57,64,211` — three install lines now pin `github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest`. - `.envrc:59` — `check_tool` install hint mirrors the v2 path so users seeing the "missing" message install the correct version. ## Verification ``` $ rm -rf build/.tools && make lint golangci-lint has version 2.12.1 built with go1.26.2 … 0 issues. ``` Matches the v2.12.1 that CI runs (`netresearch/.github`'s go-check installs via `go: downloading github.com/golangci/golangci-lint/v2 v2.12.1` per the workflow logs). ## Test plan - [x] `make lint` from clean state installs v2 and runs cleanly - [x] Commit signed off (DCO) - [ ] CI green
2 parents d32bab8 + 7092461 commit e7a7637

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ check_tool() {
5656
}
5757

5858
echo -e "${BLUE}🛠️ Checking required tools...${NC}"
59-
check_tool "golangci-lint" "go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
59+
check_tool "golangci-lint" "go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest"
6060
check_tool "gosec" "go install github.com/securego/gosec/v2/cmd/gosec@latest"
6161
check_tool "docker" "https://docs.docker.com/get-docker/"
6262

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ tidy:
5454
.PHONY: lint
5555
lint:
5656
@mkdir -p $(BUILD_PATH)/.tools
57-
@GOTOOLCHAIN=go1.26.2 GOBIN=$(BUILD_PATH)/.tools go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
57+
@GOTOOLCHAIN=go1.26.2 GOBIN=$(BUILD_PATH)/.tools go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
5858
@$(BUILD_PATH)/.tools/golangci-lint version || true
5959
@$(BUILD_PATH)/.tools/golangci-lint run --timeout=5m
6060

6161
.PHONY: lint-fix
6262
lint-fix:
6363
@mkdir -p $(BUILD_PATH)/.tools
64-
@GOTOOLCHAIN=go1.26.2 GOBIN=$(BUILD_PATH)/.tools go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
64+
@GOTOOLCHAIN=go1.26.2 GOBIN=$(BUILD_PATH)/.tools go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
6565
@$(BUILD_PATH)/.tools/golangci-lint run --fix --timeout=5m
6666

6767
.PHONY: lint-full
@@ -208,7 +208,7 @@ setup: dev-setup
208208
dev-setup:
209209
@echo "🔧 Setting up development environment..."
210210
@echo "📦 Installing required tools..."
211-
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
211+
@go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
212212
@echo "✅ golangci-lint installed"
213213
@if command -v gosec >/dev/null 2>&1; then \
214214
echo "✅ gosec already available"; \

0 commit comments

Comments
 (0)