Change information
Commit message:
go/analysis/passes/modernize: treat 'i += 1' as 'i++'
The rangeint modernize pass converts the first loop but not the second, despite
them being equivalent:
for i := 0; i < 10; i++ {}
for i := 0; i < 10; i += 1 {}
Teach the pass to permit i += 1, increasing the pass's usefulness.
Fixes golang/go#76977
Change-Id: I3e993b7d73c59cef8a3e672ca413bb16be897b1e
Files:
- M go/analysis/passes/modernize/rangeint.go
- M go/analysis/passes/modernize/testdata/src/rangeint/rangeint.go
- M go/analysis/passes/modernize/testdata/src/rangeint/rangeint.go.golden
Change size: S
Delta: 3 files changed, 41 insertions(+), 3 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Alan Donovan, +1 by Hongxiang Jiang
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI