From 573107bd9e4c397810d84ac1b6a1d0feb4bbd419 Mon Sep 17 00:00:00 2001 From: Niall Newman Date: Thu, 8 Dec 2022 15:54:08 +0000 Subject: [PATCH 1/2] Copy byte array when unmarshalling RawMessage --- raw.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/raw.go b/raw.go index 81bd002e..ee7367ae 100644 --- a/raw.go +++ b/raw.go @@ -25,7 +25,8 @@ func (v *RawMessage) UnmarshalEasyJSON(l *jlexer.Lexer) { // UnmarshalJSON implements encoding/json.Unmarshaler interface. func (v *RawMessage) UnmarshalJSON(data []byte) error { - *v = data + *v = make([]byte, len(data)) + copy(*v, data) return nil } From 34d2f3ad1a4848da7c1422bce917f14038fcee8b Mon Sep 17 00:00:00 2001 From: Niall Newman <21335031+niallnsec@users.noreply.github.com> Date: Sun, 28 Jan 2024 19:13:32 +0000 Subject: [PATCH 2/2] Only add tags to run command if set --- bootstrap/bootstrap.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index 5755beea..aff4fb49 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -187,7 +187,10 @@ func (g *Generator) Run() error { buildFlags := buildFlagsRegexp.FindAllString(g.GenBuildFlags, -1) execArgs = append(execArgs, buildFlags...) } - execArgs = append(execArgs, "-tags", g.BuildTags, filepath.Base(path)) + if len(g.BuildTags) > 0 { + execArgs = append(execArgs, "-tags", g.BuildTags) + } + execArgs = append(execArgs, filepath.Base(path)) cmd := exec.Command("go", execArgs...) cmd.Stdout = f