From 06d26d5c12d5906b8f8bac9d4409ef0631a24030 Mon Sep 17 00:00:00 2001 From: Craig Silverstein Date: Tue, 21 Jan 2020 14:56:27 -0800 Subject: [PATCH] Change writeFixedFile to replace the right line-range. The function assumed, previously, that issue.Line always equals issue.LineRange.From. But this needn't be true, and the code needn't assume it. Now we actually replace the specified line-range. --- pkg/result/processors/fixer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/result/processors/fixer.go b/pkg/result/processors/fixer.go index 401c68da..3f7abbc8 100644 --- a/pkg/result/processors/fixer.go +++ b/pkg/result/processors/fixer.go @@ -218,7 +218,7 @@ func (f Fixer) writeFixedFile(origFileLines [][]byte, issues []result.Issue, tmp } origFileLineNumber := i + 1 - if nextIssue == nil || origFileLineNumber != nextIssue.Line() { + if nextIssue == nil || origFileLineNumber != nextIssue.GetLineRange().From { outLine = string(origFileLines[i]) } else { nextIssueIndex++