Skip to content

Commit 572af21

Browse files
silverwinddelvh
andauthored
Ensure final newline in assets/go-licenses.json (#24407)
This will ensure that the file always has a final newline. I'm not sure where this bug with inconsistent final newline actually comes from, it is likely Windows-related. --------- Co-authored-by: delvh <[email protected]>
1 parent ad03c6e commit 572af21

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

assets/go-licenses.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/generate-go-licenses.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ func main() {
8282
panic(err)
8383
}
8484

85+
// Ensure file has a final newline
86+
if jsonBytes[len(jsonBytes)-1] != '\n' {
87+
jsonBytes = append(jsonBytes, '\n')
88+
}
89+
8590
err = os.WriteFile(out, jsonBytes, 0o644)
8691
if err != nil {
8792
panic(err)

0 commit comments

Comments
 (0)