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
Run R61 audited the custom go/analysis linter suite (pkg/linters/) with a 50/50 strategy: cached = the proven SuggestedFix compile-correctness vein that produced sg60a1 + #44653; new = deep audit of the 44th linter bytescomparestring and an autofix behavior-preservation probe across all 12 SuggestedFix linters. Registry moved 43 → 44. Two distinct, evidence-backed issues filed; zero duplicates.
The vein that produced sg60a1 (#44187) and #44653. Enumerated the 12 SuggestedFix linters and classified which introduce a new package in their emitted fix:
sprintfint is the last import-introducing fix that isn't self-contained → #44864.
New (50%) — 44th-linter audit + autofix behavior-preservation probe
Beyond bytescomparestring (clean, already covered by #44484), probed every SuggestedFix body for fixes that change runtime semantics rather than just refactor. Found tolowerequalfold rewrites case-incompatible comparisons to EqualFold, flipping always-false comparisons into live ones → #44865.
Problem: emits strconv.Itoa(n) with only a call-replacement TextEdit. For a file whose sole fmt/strconv use is the flagged call, applying the fix yields undefined: strconv AND "fmt" imported and not used — two compile errors.
Test masks it: the RWSF golden pre-imports strconv and keeps other fmt.Sprintf uses alive, so the import transition is never exercised.
Fix: reuse the in-fix import-edit helper (factor out of writebytestring/bytescomparestring); remove orphaned fmt; add a single-use fixture.
Effort: Small–Medium. Latent (not CI-enforced).
#44865 — tolowerequalfold autofix is not behavior-preserving (semantic-safety)
Problem: flags when either side is ToLower/ToUpper with no case-compatibility check on the other operand. strings.ToLower(a) == "HELLO" (always false) → strings.EqualFold(a, "HELLO") (not false). Mixed ToLower(a) == ToUpper(b) → EqualFold(a, b) — completely different semantics (a="Foo",b="foo": false → true).
Test masks it: fixture only tests case-matched literals (:10-12); line :11 shows the author knows ToUpper pairs with an uppercase literal, but the analyzer never enforces it.
Fix: require literal to already match the conversion's case; require both conversions to be the same function; add three negative fixtures.
Effort: Small.
Historical Context
61 total runs, 415 cumulative findings, avg success 8.75.
New vein opened this run: autofix behavior-preservation (sg61a2) — fixes that compile but change semantics.
Recommendations & Next-Run Focus
Refactor the in-fix import-edit logic (currently duplicated in writebytestring + bytescomparestring, soon a 3rd for sprintfint) into pkg/linters/internal/astutil.
R62: watch for the 45th linter; extend the behavior-preservation probe to the remaining SuggestedFix linters (fprintlnsprintf, stringsindexcontains, lenstringsplit) for fixes that compile but alter semantics; verify sg61a1/sg61a2 land.
Persist strategy memory every run — two off-log runs (07-09/07-10) filed real issues without updating the JSONL, complicating reconciliation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Executive Summary
Run R61 audited the custom go/analysis linter suite (
pkg/linters/) with a 50/50 strategy: cached = the proven SuggestedFix compile-correctness vein that produced sg60a1 + #44653; new = deep audit of the 44th linterbytescomparestringand an autofix behavior-preservation probe across all 12 SuggestedFix linters. Registry moved 43 → 44. Two distinct, evidence-backed issues filed; zero duplicates.cmd/linters/main.go)#44864,#44865)Tool & Registry Updates
bytescomparestring(string(a)==string(b)over[]byte→bytes.Equal). It is well-built — adds itsbytesimport in-fix and usesRunWithSuggestedFixes. Its only flaw (an inaccurate "allocates" premise) was already filed as bytescomparestring (new 44th linter): the "allocates" premise is inaccurate under gc — string(a) == string(b) does NOT allocate [Content truncated due to length] #44484 by an off-log run.ioimport; bytescomparestring (new 44th linter): the "allocates" premise is inaccurate under gc — string(a) == string(b) does NOT allocate [Content truncated due to length] #44484 bytescomparestring premise) were filed on 07-09/07-10 by runs that did not persist strategy memory. Both closed.writebytestringis now fully fixed in code (isExactStringwrap atwritebytestring.go:117resolves sg60a1;addIOImportEditat:213resolves 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).Strategy Split
Cached (50%) — SuggestedFix import self-containment
The vein that produced sg60a1 (#44187) and #44653. Enumerated the 12 SuggestedFix linters and classified which introduce a new package in their emitted fix:
bytesiostrconvsprintfintis the last import-introducing fix that isn't self-contained →#44864.New (50%) — 44th-linter audit + autofix behavior-preservation probe
Beyond
bytescomparestring(clean, already covered by #44484), probed every SuggestedFix body for fixes that change runtime semantics rather than just refactor. Foundtolowerequalfoldrewrites case-incompatible comparisons toEqualFold, flipping always-false comparisons into live ones →#44865.Findings & Generated Tasks
#44864 — sprintfint autofix omits strconv import + orphans fmt (compile-safety)
pkg/linters/sprintfint/sprintfint.go:94-109(buildItoaFix).strconv.Itoa(n)with only a call-replacementTextEdit. For a file whose solefmt/strconvuse is the flagged call, applying the fix yieldsundefined: strconvAND"fmt" imported and not used— two compile errors.strconvand keeps otherfmt.Sprintfuses alive, so the import transition is never exercised.fmt; add a single-use fixture.#44865 — tolowerequalfold autofix is not behavior-preserving (semantic-safety)
pkg/linters/tolowerequalfold/tolowerequalfold.go:67-69(trigger) +:90-129(buildEqualFoldFix).ToLower/ToUpperwith no case-compatibility check on the other operand.strings.ToLower(a) == "HELLO"(always false) →strings.EqualFold(a, "HELLO")(not false). MixedToLower(a) == ToUpper(b)→EqualFold(a, b)— completely different semantics (a="Foo",b="foo": false → true).:10-12); line:11shows the author knowsToUpperpairs with an uppercase literal, but the analyzer never enforces it.Historical Context
Recommendations & Next-Run Focus
pkg/linters/internal/astutil.References:
Beta Was this translation helpful? Give feedback.
All reactions