Merge pull request #381 from niallnsec/master

Copy byte array when unmarshalling RawMessage
This commit is contained in:
Vasily Romanov
2024-12-14 20:58:31 +03:00
committed by GitHub
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -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
+2 -1
View File
@@ -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
}