aboutsummaryrefslogtreecommitdiffstats
path: root/build/generate-go-licenses.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-04-28 19:39:18 +0200
committerGitHub <noreply@github.com>2023-04-28 13:39:18 -0400
commit572af214a7256fde76d0fa69fc5791b1758455ef (patch)
tree29a01b010d44c01112acaea3d36581b1152ce90d /build/generate-go-licenses.go
parentad03c6e0a36033c6f59262d8cfd6416ae3cc93d6 (diff)
downloadgitea-572af214a7256fde76d0fa69fc5791b1758455ef.tar.gz
gitea-572af214a7256fde76d0fa69fc5791b1758455ef.zip
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 <dev.lh@web.de>
Diffstat (limited to 'build/generate-go-licenses.go')
-rw-r--r--build/generate-go-licenses.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go
index bdac51e71c..addab0762a 100644
--- a/build/generate-go-licenses.go
+++ b/build/generate-go-licenses.go
@@ -82,6 +82,11 @@ func main() {
panic(err)
}
+ // Ensure file has a final newline
+ if jsonBytes[len(jsonBytes)-1] != '\n' {
+ jsonBytes = append(jsonBytes, '\n')
+ }
+
err = os.WriteFile(out, jsonBytes, 0o644)
if err != nil {
panic(err)