Summary
A new 23rd custom analyzer, sortslice, was added to the linter driver (cmd/linters/main.go) but the linter namespace documentation and its public-API spec test were not updated alongside it. They still describe 22 analyzers. This is the same new_linter_doc_lag self-consistency drift that was just fixed for the 22nd linter lenstringzero (#37740) — the 23rd repeats it.
- Linter:
pkg/linters/sortslice (flags sort.Slice / sort.SliceStable, recommends slices.SortFunc / slices.SortStableFunc)
- Type: Documentation / public-API self-consistency
- Net effect:
TestSpec_PublicAPI_SubpackageAnalyzers does not validate sortslice.Analyzer, and the namespace docs undercount the analyzers.
Evidence
Registered (23 analyzers): cmd/linters/main.go:37 imports and :63 registers sortslice.Analyzer. The driver now wires 23 analyzers.
Undocumented (still 22):
| Location |
Current state |
Should be |
pkg/linters/doc.go:3 |
All 22 active analyzers: + 22 bullets, no sortslice bullet (jumps seenmapbool -> ssljson) |
All 23, add sortslice bullet |
pkg/linters/README.md |
Zero sortslice references (bullet list, Subpackages table, import block, usage block, subpackage list all omit it) |
add the 5 sortslice entries (mirror how lenstringzero appears at README:19/49/79/95/117) |
pkg/linters/spec_test.go:63 |
documentedAnalyzers() returns 22 entries (no sortslice); spec note at :51-53 says "22 analyzer subpackages" |
add {"sortslice", sortslice.Analyzer} + bump note to 23 |
Because documentedAnalyzers() is the source list for TestSpec_PublicAPI_SubpackageAnalyzers, TestSpec_UsageExample_AnalyzersUsable, and TestSpec_DesignDecision_UniqueAnalyzerNames, the 23rd analyzer currently has no spec-test coverage of its public surface (non-nil *analysis.Analyzer, wired Name/Run, unique name).
Recommendation
Bring all three to 23, mirroring the lenstringzero precedent (#37740):
doc.go: change All 22 -> All 23; insert a sortslice bullet (alphabetical, after seenmapbool): sortslice — flags sort.Slice / sort.SliceStable calls that should use slices.SortFunc / slices.SortStableFunc.
README.md: add the sortslice bullet, Subpackages table row, import line, _ = sortslice.Analyzer usage line, and subpackage-list entry.
spec_test.go: add the sortslice import + {"sortslice", sortslice.Analyzer} entry to documentedAnalyzers() and bump the :51-53 spec note 22 -> 23.
Validation checklist
Effort: Small (docs + one test-table entry; no analyzer logic change).
Note: distinct from the open sort.Slice -> slices.SortFunc source-migration tracking issues (#38012, #38014) — this is about documenting the analyzer itself, not migrating call sites.
Generated by 🤖 Sergo - Serena Go Expert · 239.4 AIC · ⌖ 14.4 AIC · ⊞ 6.5K · ◷
Summary
A new 23rd custom analyzer,
sortslice, was added to the linter driver (cmd/linters/main.go) but the linter namespace documentation and its public-API spec test were not updated alongside it. They still describe 22 analyzers. This is the samenew_linter_doc_lagself-consistency drift that was just fixed for the 22nd linterlenstringzero(#37740) — the 23rd repeats it.pkg/linters/sortslice(flagssort.Slice/sort.SliceStable, recommendsslices.SortFunc/slices.SortStableFunc)TestSpec_PublicAPI_SubpackageAnalyzersdoes not validatesortslice.Analyzer, and the namespace docs undercount the analyzers.Evidence
Registered (23 analyzers):
cmd/linters/main.go:37imports and:63registerssortslice.Analyzer. The driver now wires 23 analyzers.Undocumented (still 22):
pkg/linters/doc.go:3All 22 active analyzers:+ 22 bullets, nosortslicebullet (jumpsseenmapbool->ssljson)All 23, addsortslicebulletpkg/linters/README.mdsortslicereferences (bullet list, Subpackages table, import block, usage block, subpackage list all omit it)sortsliceentries (mirror howlenstringzeroappears at README:19/49/79/95/117)pkg/linters/spec_test.go:63documentedAnalyzers()returns 22 entries (nosortslice); spec note at:51-53says "22 analyzer subpackages"{"sortslice", sortslice.Analyzer}+ bump note to 23Because
documentedAnalyzers()is the source list forTestSpec_PublicAPI_SubpackageAnalyzers,TestSpec_UsageExample_AnalyzersUsable, andTestSpec_DesignDecision_UniqueAnalyzerNames, the 23rd analyzer currently has no spec-test coverage of its public surface (non-nil*analysis.Analyzer, wiredName/Run, unique name).Recommendation
Bring all three to 23, mirroring the
lenstringzeroprecedent (#37740):doc.go: changeAll 22->All 23; insert asortslicebullet (alphabetical, afterseenmapbool):sortslice — flags sort.Slice / sort.SliceStable calls that should use slices.SortFunc / slices.SortStableFunc.README.md: add thesortslicebullet, Subpackages table row, import line,_ = sortslice.Analyzerusage line, and subpackage-list entry.spec_test.go: add thesortsliceimport +{"sortslice", sortslice.Analyzer}entry todocumentedAnalyzers()and bump the:51-53spec note 22 -> 23.Validation checklist
doc.gocount and bullet list = 23 (matchescmd/linters/main.go)README.mdhas all 5sortsliceentries (parity with every other analyzer)spec_test.godocumentedAnalyzers()returns 23; spec note says 23go test ./pkg/linters/...green;TestSpec_PublicAPI_SubpackageAnalyzers/sortslicenow runsEffort: Small (docs + one test-table entry; no analyzer logic change).
Note: distinct from the open
sort.Slice->slices.SortFuncsource-migration tracking issues (#38012, #38014) — this is about documenting the analyzer itself, not migrating call sites.