From c4276bfa1b35f2f6d7dcba742c6ff673e16ad3f1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Apr 2023 16:42:05 +0200 Subject: [PATCH 1/2] Normalize final newline in assets/go-licenses.json --- assets/go-licenses.json | 2 +- build/generate-go-licenses.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/go-licenses.json b/assets/go-licenses.json index 1b6ead5df654b..090f595e740ae 100644 --- a/assets/go-licenses.json +++ b/assets/go-licenses.json @@ -1104,4 +1104,4 @@ "path": "xorm.io/xorm/LICENSE", "licenseText": "Copyright (c) 2013 - 2015 The Xorm Authors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the {organization} nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" } -] \ No newline at end of file +] diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go index bdac51e71c7fa..0e1360d135c7a 100644 --- a/build/generate-go-licenses.go +++ b/build/generate-go-licenses.go @@ -82,6 +82,12 @@ func main() { panic(err) } + // Ensure file has a final newline + newline := []byte("\n")[0] + if jsonBytes[len(jsonBytes)-1] != newline { + jsonBytes = append(jsonBytes, newline) + } + err = os.WriteFile(out, jsonBytes, 0o644) if err != nil { panic(err) From 42e45c2a7ff30ce4c0ca90545d1deea323f4c186 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Apr 2023 17:15:03 +0200 Subject: [PATCH 2/2] Update build/generate-go-licenses.go Co-authored-by: delvh --- build/generate-go-licenses.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go index 0e1360d135c7a..addab0762a5f7 100644 --- a/build/generate-go-licenses.go +++ b/build/generate-go-licenses.go @@ -83,9 +83,8 @@ func main() { } // Ensure file has a final newline - newline := []byte("\n")[0] - if jsonBytes[len(jsonBytes)-1] != newline { - jsonBytes = append(jsonBytes, newline) + if jsonBytes[len(jsonBytes)-1] != '\n' { + jsonBytes = append(jsonBytes, '\n') } err = os.WriteFile(out, jsonBytes, 0o644)