From 290a6a23966f9edffe2a0a4a1d8dd065cc0753fd Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 27 May 2021 10:48:29 -0700 Subject: [PATCH] Avoid shadowing variable (#263) Rename the shadowed variable i to j for better readability. --- cmp/report_slices.go | 4 ++-- 1 file 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 {