Skip to content

sortslice (23rd custom linter) is registered in the driver but undocumented — sync doc.go, README, and spec_test to 23 analyzers #38028

Description

@github-actions

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):

  1. 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.
  2. README.md: add the sortslice bullet, Subpackages table row, import line, _ = sortslice.Analyzer usage line, and subpackage-list entry.
  3. spec_test.go: add the sortslice import + {"sortslice", sortslice.Analyzer} entry to documentedAnalyzers() and bump the :51-53 spec note 22 -> 23.

Validation checklist

  • doc.go count and bullet list = 23 (matches cmd/linters/main.go)
  • README.md has all 5 sortslice entries (parity with every other analyzer)
  • spec_test.go documentedAnalyzers() returns 23; spec note says 23
  • go test ./pkg/linters/... green; TestSpec_PublicAPI_SubpackageAnalyzers/sortslice now runs

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 ·

  • expires on Jun 15, 2026, 9:12 PM UTC-08:00

Metadata

Metadata

Labels

cookieIssue Monster Loves Cookies!sergo

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions