[sergo] Sergo Report: 30th-Linter Delta (sprintferrdot) - 2026-06-20 #40437
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Sergo - Serena Go Expert. A newer discussion is available at Discussion #40582. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Executive Summary
R42 detected a registry delta: the custom linter suite grew 29 → 30 analyzers. The new (30th) linter is
sprintferrdot(flags redundant.Error()on error args passed tofmtformat functions). Both newly-landed linters were never audited by Sergo and yielded three distinct, high-confidence findings → 3 issues filed (#40434,#40435,#40436). Issue reconciliation againstgh apiwas clean — every prior open issue is accounted for, no phantoms.Tool & Registry Updates
serena --help)cmd/linters/main.go)sprintferrdotdoc.goheaderUnder a shallow clone (no git dates), the
main.goAnalyzer-count vsdoc.goheader delta is the reliable new-linter detector — it fired this run.Strategy: strict 50/50 split
syntactic_stdlib_match, strongest land-arg): the team has repeatedly eliminatedident.Name == "<pkg>"matching in favor ofastutil.IsPkgSelector(landed:sortslice,rawloginlib,regexpcompileinfunction; Linter precision: migrate the 3 remaining CI-enforced linters that match stdlib packages by identifier name to astutil.IsPkgSele [Content truncated due to length] #40243 in-flight). I probed whether the newest linters regressed it — and both did.pattern_set_too_narrowaudit ofsprintferrdot's format-verb handling against the authoritativefmtspec (verified via WebFetch of pkg.go.dev/fmt).Run targets: ≥2 precision findings on new linters; ≤3 issues, all non-duplicate, single/small-PR scope; cache updated. All met.
Findings → Issues
#40434sprintferrdot(30th)#40435fileclosenotdeferred,contextcancelnotdeferred#40436doc.goinventoryDetail: #40434 — sprintferrdot verb gate wrong in both directions
fmtinvokesError()for verbs %s %q %v %x %X but not %#v (confirmed against pkg.go.dev/fmt: "valid for a string (%s %q %x %X), or is %v but not %#v").sprintferrdotonly checks{s, v}(sprintferrdot.go:89) andparseSimpleFormatVerbsdiscards the#flag (:156), so:fmt.Sprintf("%#v", err.Error())is flagged, but%#vuses the Go-syntax representation and does not callError()— dropping.Error()is behavior-changing. (If ever CI-enforced, this is a build-blocker with a wrong fix.)%q/%x/%Xwitherr.Error()are genuinely redundant but skipped.Detection of
.Error()itself is sound (TypesInfo+types.Implements,:191-208). Zero production sites today (latent), but spec-grounded. Fix: track#, widen verb set to{s,q,v,x,X}excluding%#v.Detail: #40435 — two newest linters re-introduce syntactic package matching
fileclosenotdeferred:172ident.Name != "os"contextcancelnotdeferred:138pkgIdent.Name != "context"Same defect class as the landed precedents: FP on a shadowing local var (
os := ...; os.Open(...)) and FN on alias imports (import osx "os").astutil.IsPkgSelectorexists (astutil.go:75-94) and the newest format lintersprintferrdot:109already uses it correctly — these two missed it. Distinct from #40243 (scoped to 3 CI-enforcedos/fmt/stringsholdouts); filing these completes the codebase-wide consolidation and stops the antipattern regressing on every new linter.Detail: #40436 — doc.go inventory drift
doc.go:3says "29 active analyzers" but 30 are registered, and the bullet list omits bothhardcodedfilepath(main.go:63) andsprintferrdot(main.go:75). Same class as the closed #38787/#38028; recurs whenever a linter lands. Trivial doc-only fix.Metrics
Historical context
Reconcile confirmed R41's
sg41a1 → #40243andsg41a2 → #40244both open, and#39982(jsonmarshal ExprStmt FN) still open. Prior fixes (#39733,#39981) remain landed-in-code-but-open — the team does not auto-close, so grepping code is mandatory before re-filing (no phantoms re-filed this run).Recommendations & next-run focus (R43)
ident.Name == "<pkg>"after Linter precision: migrate the 3 remaining CI-enforced linters that match stdlib packages by identifier name to astutil.IsPkgSele [Content truncated due to length] #40243 lands — R42 proved new linters regress the antipattern, so a periodic sweep is warranted.errorfwrapv,excessivefuncparams,largefunc,errormessage,ossetenvlibrary,seenmapbool,lenstringzero.sprintferrdotshould even listFscanfamong format calls (its args are scan-target pointers, not formatted values).pattern_setprobes:tolowerequalfold(ToLower+ToUpper?),httpnoctx(all client methods?).main.go-vs-doc.gocount.References: §27860925409
Beta Was this translation helpful? Give feedback.
All reactions