build(lint): add golangci-lint v2.14.0 tools modfile - #174
Merged
Merged
Conversation
- add go.tools.mod pinning golangci-lint v2.14.0 via the tools module - add go.tools.sum for the tools module dependencies - add Makefile targets using TOOLS_MOD for install-tools, fmt, and lint - adopt .golangci.yml based on the go-signet/signet configuration Co-Authored-By: Claude Code <noreply@anthropic.com>
Apply the formatting/lint fixes required by the new .golangci.yml so the CI lint job passes with golangci-lint v2.14.0: - gci/golines/gofumpt: reformat imports (group the module's own path) and wrap flag.String calls via golangci-lint fmt - modernize: range-over-int loops, atomic.Int32/types, WaitGroup.Go - testifylint: error assertions use require; float compares use InEpsilon; keep assert in non-test goroutines - revive: clock += 1 -> clock++ - staticcheck ST1016: unify receiver names on Ring/Consumer - forbidigo: nolint fmt.Println in goroutine-leak diagnostics - keep pointer-returning option helpers (job.Int64/Float64/Time/Bool) and suppress modernize newexpr to avoid the govet inline cascade Co-Authored-By: Claude Code <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.
Summary
Adopt the
go.tools.modtooling flow from go-signet/signet so thatgolangci-lintis pinned to a single version (v2.14.0) and invoked through a dedicated tools go.mod, instead of relying on a globally-installedgolangci-lint.go.tools.mod/go.tools.sum— a dedicated tools module that declaresgolangci-lint(v2.14.0) as atooldependency.go.modbuild and tooling dependencies are now fully separated, and the lint version is reproducible across local dev and CI.Makefile— introduceTOOLS_MOD := -modfile=go.tools.modand addinstall-tools,fmt, andlinttargets so the linter is driven throughgo tool -modfile=go.tools.mod golangci-lint ...(matching the signet Makefile pattern)..golangci.yml— adopt the signet configuration (golangci-lint v2 schema): enablesbidichk,bodyclose,depguard,errcheck,forbidigo,gocheckcompilerdirectives,gocritic,govet,ineffassign,mirror,modernize,nakedret,nilnil,nolintlint,perfsprint,revive,staticcheck,testifylint,unconvert,unparam,unused,usestdlibvars,usetesting,wastedassign; formattersgci/gofmt/gofumpt/golineswith the module's own import path set as thegcilocal prefix.The
godirective ingo.tools.modis kept in sync with this repo'sgo.mod.Related issues
Architecture / flow
AI authorship
go.tools.mod,go.tools.sum,Makefile,.golangci.ymlChange classification
The lint tooling and configuration affect every contributor's local workflow and CI, and other modules in the
golang-queueorg share this convention.Plan reference
Mirror the tooling flow of
go-signet/signet(go.tools.mod,MakefileTOOLS_MODtargets,.golangci.yml) sogolangci-lintversion stays consistent acrossgolang-queue/*modules.Verification
Setup
build/golangci-lint-tools-modfilein this repo.go.modgodirective (1.26.x). No Docker/broker needed — this change is build/lint tooling only; it does not touch runtime code or tests.Automated checks
go tool -modfile=go.tools.mod golangci-lint versiongo.tools.modand prints2.14.0golangci-lint has version 2.14.0 built with go1.26.8go tool -modfile=go.tools.mod golangci-lint config verify.golangci.ymlparses and all referenced linter settings are validmake install-tools(go mod download -modfile=go.tools.mod)go mod downloadcompletes with no errorgit diff --checkmake test/go test ./...)Behavioral scenarios
Scenario: lint runs locally with the pinned version via the tools modfile
make lintinvokesgolangci-lint v2.14.0fromgo.tools.modwithout needing a globally installed binary.build/golangci-lint-tools-modfile, Go 1.26.x available.make install-toolsgo mod downloadcompletes; no errormake lintgo tool -modfile=go.tools.mod golangci-lint run; reports lint findings (pre-existing code may surface findings under the stricter config — that is expected and out of scope for this PR)make lintrun will surface pre-existing findings under the newly-enabled strict linters, which is intended to be addressed in follow-ups rather than bundled into the tooling-landing PR.queuemodule a sample run surfaced 5 pre-existing findings (forbidigo, gci, modernize, staticcheck, testifylint) in existing code — none due to the tooling files themselves.Scenario: formatting via the tools modfile
make fmtformats Go sources throughgolangci-lint fmtusing the pinned binary.make fmtgo tool -modfile=go.tools.mod golangci-lint fmt; appliesgci/gofmt/gofumpt/golinesper.golangci.ymlconfig verifypassed); fullmake fmtleft to the reviewer to confirm intent on a per-module basis.Security check
Risk and rollback
.golangci.ymlenables stricter linters than the previous one; CI lint may surface pre-existing findings and fail until the code is cleaned up in follow-up PRs. Reviewers should decide whether to land the config now (and fix findings separately) or pre-clean first..golangci.yml/Makefile/removego.tools.mod/go.tools.sum. The change is additive (no source code touched).Reviewer guide
.golangci.yml— the enabled linters and thegcilocal prefix (must match this repo's module path);MakefileTOOLS_MODusage;go.tools.modgodirective matchesgo.mod.go.tools.sumand the indirect dependency list (generated bygo mod tidy -modfile=go.tools.mod; mechanical).🤖 Generated with Claude Code