gofmt: autofix missing newline at EOF (#3917)

This commit is contained in:
Ksenia Rogova 2023-06-18 16:49:17 +03:00 committed by GitHub
parent 7cf30e7b51
commit 28f056032c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -80,6 +80,16 @@ func (p *hunkChangesParser) parseDiffLines(h *diffpkg.Hunk) {
ret = append(ret, dl)
}
// if > 0, then the original file had a 'No newline at end of file' mark
if h.OrigNoNewlineAt > 0 {
dl := diffLine{
originalNumber: currentOriginalLineNumber + 1,
typ: diffLineAdded,
data: "",
}
ret = append(ret, dl)
}
p.lines = ret
}

View File

@ -7,4 +7,4 @@ package p
return 1
}
return 2
}
}