chore(go): lint every Go module with gofumpt, golangci-lint, and go fix - #1425
Conversation
`lint:go` hardcoded `gofmt -l go benches/go` and ran `go vet` in two named
directories, so `integrations/cobra` was linted by nothing. Replace it with hk
builtins keyed on `workspace_indicator = "go.mod"` so hk resolves each module
itself: gofumpt for formatting, golangci-lint, `go fix`, and `go mod tidy -diff`.
`usage generate go` and the kong shadow emitter now write `type X struct{}` for an
empty struct rather than `struct {\n}`. gofumpt skips generated files when walking
a directory but formats them when given explicit paths, so emitting what the
formatter wants is what keeps generated output clean without a post-pass.
Drop the `benches/go` carve-out from `lint:go` and `test:go`. Its stated purpose
was that a machine without a proxy should still get the suite that matters, but
the `go` module needs `expr` fetched too, so on a cold cache that suite fails
before the probe is reached.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (28)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughChangesGo maintenance and tooling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Other Suggested reviewers: Merge Risk: ⚪ Minimal · up to The reviewed changes preserve the described behavior or update development tooling; no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 76.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 59 functions across 24 files. (4 skipped: 2 unsupported, 2 too large.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
What changed
All three Go modules —
go,integrations/cobra,benches/go— are now linted by one shared config.integrations/cobrawas previously linted by nothing:lint:gohardcodedgofmt -l go benches/goand rango vetin two named directories. The replacements are hk builtins keyed onworkspace_indicator = "go.mod"so hk resolves each module itself: gofumpt, golangci-lint,go fix, andgo mod tidy -diff.mise run lintalready runshk check --all, so CI needs no workflow change.The new linters turned up four dead functions, five staticcheck rewrites in
argv, two unchecked errors in the cobra test, and onego fixmodernization.Generated Go changes shape
usage generate gonow emitstype X struct{}for a command with no flags, args, or subcommands, rather than:Adopters who regenerate will see this in their diff. gofumpt skips generated files when walking a directory but formats them when given explicit paths, so emitting what the formatter wants is what keeps generated output clean without a post-pass;
gen-shadownow passes explicit paths for the same reason. The kong shadow emitter inxtaskgot the same fix.benches/go is no longer special-cased
It is the only module with third-party dependencies, and
lint:goandtest:goboth probedgo mod downloadso they could skip it when those cannot be fetched. Both probes are gone. Thetest:goone existed so that an offline machine "should still get the suite that matters", but thegomodule needsexprfetched too, so that suite fails first on a cold cache.tasks/perf-go.shkeeps its equivalent, since it labels missing benchmark rows in the report rather than skipping quietly.Worth a reviewer's attention
--allow-serial-runners: it takes a global lock and hk runs it once per module, so otherwise the second instance fails instead of waiting.Builtins.go_vetis deliberately absent.govetis in golangci-lint's standard set and runs the same passes.mise run lint,mise run test:goincluding the full conformance corpus, andusage-lib's tests pass, andgen-go,gen-shadow, andrenderproduce no diff. Three shell-completion tests fail locally on macOS without the systembash-completionthat CI installs, identically on an unmodified checkout.AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.236.