Skip to content

Commit

Permalink
Merge pull request #381 from niallnsec/master
Browse files Browse the repository at this point in the history
Copy byte array when unmarshalling RawMessage
  • Loading branch information
rvasily authored Dec 14, 2024
2 parents 141f9c7 + 34d2f3a commit d48874a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit d48874a

Please sign in to comment.