aboutsummaryrefslogtreecommitdiff
path: root/cmp/report_slices.go
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-08-05 18:16:46 +0200
committerJoe Tsai <joetsai@digital-static.net>2019-08-05 09:16:46 -0700
commit208900aad7b7057a89131f7e63836689b675a042 (patch)
tree6ec4e2d59e75ea2fac970cd1a15f747071ab2b2e /cmp/report_slices.go
parent6d8cafd2f64fe3cd66b7530d95df066b00bdd777 (diff)
downloadgo-cmp-208900aad7b7057a89131f7e63836689b675a042.tar.gz
Fix updating of maxLineLen (#147)
Previously, the line pointlessly updated the lastLineIdx variable since the subsequent line always assigned to it. Change it to update maxLineLen, which was the original intention.
Diffstat (limited to 'cmp/report_slices.go')
-rw-r--r--cmp/report_slices.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmp/report_slices.go b/cmp/report_slices.go
index 667a6e3..eafcf2e 100644
--- a/cmp/report_slices.go
+++ b/cmp/report_slices.go
@@ -90,7 +90,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode {
}
if r == '\n' {
if maxLineLen < i-lastLineIdx {
- lastLineIdx = i - lastLineIdx
+ maxLineLen = i - lastLineIdx
}
lastLineIdx = i + 1
numLines++