[sergo] Sergo Report: Delta-43→54 New-Linter Audit + Doc-Sync Recount - 2026-07-20 #46709
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Sergo - Serena Go Expert. A newer discussion is available at Discussion #46979. |
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
R61 opened onto a large registry jump:
cmd/linters/main.gowent from 43 → 54 registered analyzers (+11 in the 12 days since R60), and the team had already closed every prior sergo issue. Cross-referencing the 11 new linters against filed-issue history, exactly two had never been audited —timenowsubandappendoneelement— so both got a deep single-file audit.appendoneelementis fully clean;timenowsubis clean at its core but yielded two distinct findings (one recurring doc-sync drift, one narrowness FN). 2 issues filed.Tool / Registry Updates
grep -c Analyzer main.go)11 new linters since R60:
appendoneelement,bytesbufferstring,bytescomparestring,ioutildeprecated,logfatallibrary,mapclearloop,mapdeletecheck,nilctxpassed,stringscountcontains,timenowsub,trimleftright. Nine already had issues filed & closed (e.g. #44484, #45379, #45903, #46130, #46341, #46526). The two remaining —timenowsub,appendoneelement— were this run's targets.Strategy — explicit 50/50 split
Cached component (proven "new-linter audit" vein): the highest-yield recurring Sergo strategy. Adapted to the +11 delta by diffing new linters against closed-issue titles to isolate the unaudited subset, then applying the standard checklist per linter: autofix compile-correctness,
RunWithSuggestedFixesparity (#43313 class), type-resolution vs syntactic package matching (#43934 class), pattern-set narrowness, and nolint/generated-file wiring.New-exploration component: a syntactic-stdlib-match regression sweep across all 11 new linters (grep for
.Name == "<stdpkg>"identifier matching that ignores shadowing/aliasing) to confirm the #43934astutil.IsPkgSelectormigration held for newly-added code — plus the recurring doc-sync recount (header/bullet count vs registry).Run targets: ≥1 strong distinct finding; 0 duplicates (verified all sergo issues closed); 1–3 issues.
Findings & Evidence
appendoneelement — audited CLEAN (no issue)
append(s, []T{x}...)→append(s, x).[]T{x}must be assignable to[]S(S = element type ofs); slice assignability requires T == S, soxis always assignable tos's element type andappend(s, x)is well-typed. No named-vs-exact-type trap (contrast writebytestring writebytestring (new 43rd linter): autofix emits non-compiling io.WriteString(w, s) for named string types + missing RunWithSugg [Content truncated due to length] #44187).appendviatypes.Universe.Lookup("append")(line 57) — no shadowing FP (testdatagoodShadowedAppend).[]int{5:3}), multi-element literals, and type-elided nested literals ([][]int{{1}}).RunWithSuggestedFixes+ golden;nolint+ generated-file skip wired.Finding 1 (#46707) — doc-sync drift: doc.go "53" vs 54 registered
pkg/linters/doc.go:3—// All 53 active analyzers:with exactly 53// -bullets.cmd/linters/main.goregisters 54 (timenowsub.Analyzerat line 125 has no bullet — list skipstimeafterleak → timesleepnocontext → tolowerequalfold).timenowsubbullet + bump header to 54; suggested a CI guard assertingbullet_count == registered_countto retire the class.Finding 2 (#46708) — timenowsub isSafeSinceArg narrowness (FN)
pkg/linters/timenowsub/timenowsub.go:131-140—isSafeSinceArgaccepts only*ast.Ident/*ast.ParenExpr, rejecting side-effect-free selectors (s.start,p.startTime).goodCallExprArg), but a field/pkg-var read is pure and evaluation-order-invariant against the no-side-effectNow(), sotime.Now().Sub(s.start)→time.Since(s.start)is a safe simplification being missed.time.Now().Sub(sites inpkg/; non-CI-enforced simplification linter. Class:pattern_set_too_narrow(cf. lenstringzero coverage gap: len(s) != 0 is flagged but the identical idiom len(s) > 0 (and len(s) < 1 / <= 0) escapes — relation [Content truncated due to length] #40581, errstringmatch coverage gap: only strings.Contains(err.Error(), ...) is flagged — HasPrefix/HasSuffix/EqualFold/Index on err.Err [Content truncated due to length] #40244).case *ast.SelectorExpr: return true+ testdata pair.Sweep result: syntactic-stdlib-match regression sweep across all 11 new linters found zero holdouts — the #43934
IsPkgSelectormigration held;timenowsub(ObjectOf/PkgName) andappendoneelement(Universe.Lookup) are both properly type-resolved.Generated Tasks
timenowsubbullet + header→54; optional CI count-guard. Effort: trivial.isSafeSinceArgto*ast.SelectorExpr+ testdata. Effort: small.Metrics
Historical Context
The "new-linter audit" vein remains the highest-yield strategy (R58 execcommandwithoutcontext, R60 writebytestring #44187). This run confirms the team's fast close cadence — 11 linters + ~15 issues resolved in 12 days — so pre-run
gh apireconciliation is essential;gh issue list --searchremains broken (usegh api ...issues?labels=sergo). Doc-sync drift is now a confirmed recurring class (5th occurrence) — hence the CI-guard recommendation.Recommendations & Next-Run Focus (R62)
grep -c Analyzer cmd/linters/main.govs 54.trimleftright,nilctxpassed,mapdeletecheck) to confirm their already-closed issues were fixed correctly, not just closed.References:
Beta Was this translation helpful? Give feedback.
All reactions