Alan Donovan submitted the change![Open in Gerrit]()
Change information
Commit message:
go/analysis/passes/modernize: forvar: handle "if v := v; cond {"
Some analyzers' (especially stditerator's) fixes result
in redundant v := v assignments, often as the "init" part of
an if statement. This change causes the forvar analyzer to
clean them up when the if statement is the sole statement
of the loop body.
+ test
For golang/go#76241
For golang/go#76240Change-Id: I327d8726b0d2439a5cc55765acefdfa463282728
Files:
- M go/analysis/passes/modernize/forvar.go
- M go/analysis/passes/modernize/testdata/src/forvar/forvar.go
- M go/analysis/passes/modernize/testdata/src/forvar/forvar.go.golden
Change size: M
Delta: 3 files changed, 74 insertions(+), 24 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Robert Findley
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I327d8726b0d2439a5cc55765acefdfa463282728
Gerrit-Change-Number: 719360
Gerrit-PatchSet: 4