Skip to content

doc-sync: pkg/linters/doc.go says "45 active analyzers" but 51 are registered — 6 newest linters omitted #46131

Description

@github-actions

Summary

pkg/linters/doc.go has drifted out of sync with the analyzer registry in cmd/linters/main.go. The doc header reads // All 45 active analyzers: and lists 45 bullets, but 51 analyzers are actually registered — a drift of 6.

This is the same doc-sync class fixed before (#40436, #45185); the list has simply fallen behind again as 6 new linters landed without doc updates.

Evidence

  • Registered: cmd/linters/main.go:74-124 → 51 *.Analyzer, entries.
  • Documented: pkg/linters/doc.go:3 header // All 45 active analyzers: + 45 // - <name> bullets.

The 6 omitted analyzers (registered but absent from doc.go bullets)

  • bytesbufferstring
  • ioutildeprecated
  • logfatallibrary
  • mapclearloop
  • mapdeletecheck
  • stringscountcontains

These are exactly the 6 newest linters.

Impact

  • The package doc is the canonical human-facing inventory of the custom linters; a 6-analyzer undercount plus a wrong header count misleads contributors about what coverage exists and which linters to reference for //nolint directives.
  • Low runtime risk, but it recurs every few linters and has previously been treated as worth fixing.

Recommendation

  1. Update the header to // All 51 active analyzers:.
  2. Add the 6 missing bullets (alphabetical, matching the existing one-line name — description style; descriptions can be lifted from each analyzer's Doc field).
  3. Consider a tiny CI/test check that asserts len(registered analyzers) == number of doc.go bullets == header count, so this cannot silently drift again (the recurrence — doc-sync: pkg/linters/doc.go says "29 active analyzers" but 30 are registered — list omits hardcodedfilepath and sprintferrdot #40436, doc-sync: pkg/linters/doc.go says "44 active analyzers" but 45 are registered — the list omits stringscountcontains #45185, now this — argues for automating it).

Validation checklist

  • Header count equals grep -c 'Analyzer,' cmd/linters/main.go (51).
  • Every registered analyzer name has exactly one doc.go bullet and vice-versa.
  • (Optional) A test in pkg/linters fails if the counts diverge.

Effort: trivial (doc-only), plus optional small guard test.

Generated by 🤖 Sergo - Serena Go Expert · 367.5 AIC · ⌖ 14.7 AIC · ⊞ 5.8K ·

  • expires on Jul 23, 2026, 9:03 PM UTC-08:00

Metadata

Metadata

Labels

cookieIssue Monster Loves Cookies!sergo

Type

No type

Fields

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