ci: fix lint job (Go 1.24 + golangci-lint config)#9
Merged
Conversation
The lint job never actually ran: CI pinned Go 1.22 but go.mod requires 1.24, so setup-go downloaded the 1.24 toolchain and golangci-lint's cache extraction collided (`tar: File exists`), failing before linting. - Bump setup-go to 1.24 in ci.yml (test + lint) and release.yml so the toolchain matches go.mod and installs directly. - Add .golangci.yml. Since lint had never run, enabling it surfaced many pre-existing findings. Keep all correctness (SA*) checks; exclude the retroactive-style noise the codebase consistently uses: errcheck on best-effort cleanup (deferred Close, Remove/RemoveAll/MkdirAll/WriteFile), QF1012 (WriteString+Sprintf style), and ST1000 (package-comment convention). - Fix two real findings cleanly: S1021 (merge var decl in trace_cmd.go) and remove two dead functions (buildLabels, positionNodes — thin unused wrappers). `golangci-lint run ./...` is now clean; build and tests unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The initial fix used a v2-schema .golangci.yml, but golangci-lint-action@v6 resolves `version: latest` to golangci-lint v1.64.8, which rejects the v2 config (`config verify` fails: unknown 'version'/'settings' keys). Pin the action to @v7 and golangci-lint v2.12.2 (matches local, where `config verify` passes and `run ./...` is clean) so CI honors the v2 config. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The CI
lintjob never actually ran: the workflow pinned Go 1.22 butgo.modrequires 1.24, sosetup-godownloaded the 1.24 toolchain and golangci-lint's cache extraction collided (tar: File exists), failing during setup — before any linting. (Thetestjob passed throughout.)Fix
setup-goto 1.24 inci.yml(test + lint) andrelease.yml, matchinggo.mod..golangci.yml. Because lint had never run, enabling it surfaced many pre-existing findings. Kept all correctness (SA*) checks; excluded the retroactive-style noise the codebase uses consistently:errcheckon best-effort cleanup (deferredClose,Remove/RemoveAll/MkdirAll/WriteFile)QF1012(WriteString+Sprintf style quickfix)ST1000(package-comment convention)S1021(merge var decl intrace_cmd.go) and removed two dead functions (buildLabels,positionNodes— provably-unused thin wrappers).Verified
golangci-lint run ./...→ 0 issues locally. Build and full test suite unchanged (green except the known macOS-only daemon socket-path flake, task #11, which doesn't occur on Linux CI).Rationale for the config over a repo-wide rewrite: lint was never enforced, so there's no clean baseline; suppressing the noisy style/quickfix categories keeps lint meaningful (still catches real bugs) without churning many pre-existing files. Happy to tighten incrementally later.
🤖 Generated with Claude Code