aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2021-05-27 10:48:29 -0700
committerGitHub <noreply@github.com>2021-05-27 10:48:29 -0700
commit290a6a23966f9edffe2a0a4a1d8dd065cc0753fd (patch)
treed47dea10d02481a11a0da62b8e8031ae384e6655
parent248ccfffa4b8906ebc7f9ab720fe5b6012bb7745 (diff)
downloadgo-cmp-290a6a23966f9edffe2a0a4a1d8dd065cc0753fd.tar.gz
Avoid shadowing variable (#263)
Rename the shadowed variable i to j for better readability.
-rw-r--r--cmp/report_slices.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmp/report_slices.go b/cmp/report_slices.go
index 2ad3bc8..9809228 100644
--- a/cmp/report_slices.go
+++ b/cmp/report_slices.go
@@ -563,10 +563,10 @@ func cleanupSurroundingIdentical(groups []diffStats, eq func(i, j int) bool) []d
nx := ds.NumIdentical + ds.NumRemoved + ds.NumModified
ny := ds.NumIdentical + ds.NumInserted + ds.NumModified
var numLeadingIdentical, numTrailingIdentical int
- for i := 0; i < nx && i < ny && eq(ix+i, iy+i); i++ {
+ for j := 0; j < nx && j < ny && eq(ix+j, iy+j); j++ {
numLeadingIdentical++
}
- for i := 0; i < nx && i < ny && eq(ix+nx-1-i, iy+ny-1-i); i++ {
+ for j := 0; j < nx && j < ny && eq(ix+nx-1-j, iy+ny-1-j); j++ {
numTrailingIdentical++
}
if numIdentical := numLeadingIdentical + numTrailingIdentical; numIdentical > 0 {