Skip to content

doc-sync: pkg/linters/doc.go says "53 active analyzers" but 54 are registered — timenowsub is omitted #46707

Description

@github-actions

Summary

pkg/linters/doc.go has drifted out of sync with the analyzer registry again. The package header claims 53 analyzers, but cmd/linters/main.go registers 54. The omitted entry is timenowsub.

This is the same recurring drift class previously filed and fixed as #46527 (52→53), #46131, #45185, and #40436. The doc header is hand-maintained and lags each new-linter landing.

Evidence

  • pkg/linters/doc.go:3// All 53 active analyzers:
  • The bulleted list in doc.go contains exactly 53 // - <name> entries.
  • cmd/linters/main.go multichecker.Main(...) registers 54 analyzers (grep -c Analyzer cmd/linters/main.go = 54, one per line, lines 77–130).
  • The list jumps from timeafterleaktimesleepnocontexttolowerequalfold; the registered timenowsub.Analyzer (main.go:125) has no corresponding bullet.

Impact

Low severity but recurring: the header count and enumerated list are the human-facing catalogue of the lint suite. A missing entry means timenowsub (and its rationale) is invisible to anyone reading the package doc, and the count assertion is simply wrong. It also tends to accumulate — #46131 showed 6 linters silently omitted at once.

Recommendation

  1. Add the missing bullet in alphabetical position (between timeafterleak/timesleepnocontext cluster — specifically after timesleepnocontext per the current ordering, matching main.go's grouping) :
//   - timenowsub — reports time.Now().Sub(t) calls that should be simplified to time.Since(t)
  1. Bump the header to // All 54 active analyzers:.

Validation checklist

  • doc.go header reads All 54 active analyzers:
  • doc.go bullet list has 54 entries and includes timenowsub
  • Count of // - bullets equals grep -c Analyzer cmd/linters/main.go
  • Consider a tiny test/CI guard asserting header-count == registered-analyzer-count to stop this recurring drift for good (see the repeated history of this exact issue).

Effort

Trivial (one-line doc edit + header bump). The optional CI guard is a small follow-up that would retire this whole issue class.

Sergo R61 — new-linter/doc-sync audit. appendoneelement and timenowsub (the two linters added since R60 without prior issues) were both audited; appendoneelement is correctness-clean.

Generated by 🤖 Sergo - Serena Go Expert · 243.2 AIC · ⌖ 11 AIC · ⊞ 5.8K ·

  • expires on Jul 26, 2026, 9:05 PM UTC-08:00

Metadata

Metadata

Labels

cookieIssue Monster Loves Cookies!sergo

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions