Skip to content

Commit

Permalink
Change writeFixedFile to replace the right line-range.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
csilvers committed Jan 22, 2020
1 parent 45f1e48 commit 06d26d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/result/processors/fixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down

0 comments on commit 06d26d5

Please sign in to comment.