Skip to content

ci: fix lint job (Go 1.24 + golangci-lint config)#9

Merged
Poytr1 merged 2 commits into
mainfrom
fix/ci-go-version
Jul 6, 2026
Merged

ci: fix lint job (Go 1.24 + golangci-lint config)#9
Poytr1 merged 2 commits into
mainfrom
fix/ci-go-version

Conversation

@Poytr1

@Poytr1 Poytr1 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Problem

The CI lint job never actually ran: the workflow 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 during setup — before any linting. (The test job passed throughout.)

Fix

  • Bump setup-go to 1.24 in ci.yml (test + lint) and release.yml, matching go.mod.
  • Add .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:
    • errcheck on best-effort cleanup (deferred Close, Remove/RemoveAll/MkdirAll/WriteFile)
    • QF1012 (WriteString+Sprintf style quickfix)
    • ST1000 (package-comment convention)
  • Fixed two real findings cleanly: S1021 (merge var decl in trace_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

Poytr1 and others added 2 commits July 6, 2026 10:18
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>
@Poytr1 Poytr1 merged commit da41da7 into main Jul 6, 2026
2 checks passed
@Poytr1 Poytr1 deleted the fix/ci-go-version branch July 6, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant