You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sprintfbool (new 55th linter) enforce-readiness: clean, type-resolved, RWSF-verified, alias-safe, zero production violations — a
[Content truncated due to length] #46978
sprintfbool (pkg/linters/sprintfbool, the newly-added 55th analyzer) flags fmt.Sprintf("%t", b) where b is a bool and rewrites it to strconv.FormatBool(b). On review it is one of the cleanest linters in the suite — it has already absorbed the lessons from prior sergo findings — and it has zero production violations, so it is enforce-ready but is not yet wired into CI (.github/workflows/cgo.yml:1208-1211 enforces 24 linters; sprintfbool is absent).
Correctness review — clean (prior-bug classes all avoided)
Checks that pass (with the sergo finding each corresponds to)
nolint + filecheck wired — Requires includes both (sprintfbool.go:36); //nolint:sprintfbool and generated-file skipping are honored and tested (suppressed fixture; shadow/comment_overlap fixtures cover the bail-outs).
Untyped literals handled — fmt.Sprintf("%t", true) is flagged (default-typed to bool); fixture badLiteral.
Enforce-readiness evidence
$ grep -rn 'Sprintf("%t"' pkg cmd internal | grep -v testdata
# only the linter's own doc/message strings match — ZERO production call sites
Zero production violations under the default build ⇒ adding sprintfbool to CI cannot break the build today and locks in the improvement going forward. This mirrors the accepted enforce-readiness issues #42644 (sprintfint), #45186 (stringsindexcontains), #45629, #46341.
Recommendation
Add -sprintfbool to both LINTER_FLAGS invocations in .github/workflows/cgo.yml (the default-build run at :1208 and the wasm run at :1211).
- run: make golint-custom LINTER_FLAGS="... -mapdeletecheck -test=false"+ run: make golint-custom LINTER_FLAGS="... -mapdeletecheck -sprintfbool -test=false"
Validation checklist
make golint-custom LINTER_FLAGS="-sprintfbool -test=false" reports zero findings on the default build.
Same under GOOS=js GOARCH=wasm for the wasm LINTER_PACKAGES set.
-sprintfbool added to both cgo.yml invocations.
Effort: trivial (two-line CI edit) once verified. Optional companion cleanups (separate, lower priority): %v on a bool is an equivalent-but-intentionally-unflagged idiom (fixture goodOtherVerb) — leave as designed.
Summary
sprintfbool(pkg/linters/sprintfbool, the newly-added 55th analyzer) flagsfmt.Sprintf("%t", b)wherebis abooland rewrites it tostrconv.FormatBool(b). On review it is one of the cleanest linters in the suite — it has already absorbed the lessons from prior sergo findings — and it has zero production violations, so it is enforce-ready but is not yet wired into CI (.github/workflows/cgo.yml:1208-1211enforces 24 linters;sprintfboolis absent).Correctness review — clean (prior-bug classes all avoided)
Checks that pass (with the sergo finding each corresponds to)
Underlying()—sprintfbool.go:112requiresargType == types.Typ[types.Bool]. Named bool types (type myBool bool) are correctly not flagged, becausestrconv.FormatBooltakes the predeclaredbooland a named type is not assignable — so the autofix always compiles. This is exactly the mistakewritebytestringmade (writebytestring (new 43rd linter): autofix emits non-compiling io.WriteString(w, s) for named string types + missing RunWithSugg [Content truncated due to length] #44187/writebytestring autofix references io.WriteString but never adds the "io" import — non-compiling fix when the file doesn't alrea [Content truncated due to length] #44653:t.Underlying()==Stringmatched named strings → non-compilingio.WriteString). FixturegoodNamedBool(testdata/.../sprintfbool.go:29) documents the intent.RunWithSuggestedFixes—sprintfbool_test.go:16uses RWSF (not plainanalysistest.Run), closing the verification-parity gap that Autofix verification-parity gap: 3 of 9 SuggestedFix linters (stringsindexcontains, sprintfint, stringreplaceminusone) have zero [Content truncated due to length] #43313 flagged for older linters.astutil.IsPkgSelector—sprintfbool.go:93, not a syntacticsel.X.Name == "fmt"string match (the regression class from Linter precision (regression): the syntactic stdlib-package-match migration never landed — 5 holdouts remain, 3 CI-enforced (#40 [Content truncated due to length] #43934/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).replacementForCall(sprintfbool.go:419) resolves the local binding viaastutil.ImportedAsand emits<localName>.FormatBool, and skips on./_imports and shadowing (QualifierShadowed, line 427). This avoids the hardcoded-default-qualifier bug filed for the siblings in Autofix import robustness: sprintfint/writebytestring/bytescomparestring key import-presence on the path but emit a hardcoded pa [Content truncated due to length] #45037.nolint+filecheckwired —Requiresincludes both (sprintfbool.go:36);//nolint:sprintfbooland generated-file skipping are honored and tested (suppressedfixture;shadow/comment_overlapfixtures cover the bail-outs).fmt.Sprintf("%t", true)is flagged (default-typed tobool); fixturebadLiteral.Enforce-readiness evidence
Zero production violations under the default build ⇒ adding
sprintfboolto CI cannot break the build today and locks in the improvement going forward. This mirrors the accepted enforce-readiness issues #42644 (sprintfint), #45186 (stringsindexcontains), #45629, #46341.Recommendation
Add
-sprintfboolto bothLINTER_FLAGSinvocations in.github/workflows/cgo.yml(the default-build run at:1208and the wasm run at:1211).Validation checklist
make golint-custom LINTER_FLAGS="-sprintfbool -test=false"reports zero findings on the default build.GOOS=js GOARCH=wasmfor the wasmLINTER_PACKAGESset.-sprintfbooladded to bothcgo.ymlinvocations.Effort: trivial (two-line CI edit) once verified. Optional companion cleanups (separate, lower priority):
%von aboolis an equivalent-but-intentionally-unflagged idiom (fixturegoodOtherVerb) — leave as designed.