don't allow intern/nocopy tags at the same time

This commit is contained in:
Kirill Korotaev
2020-04-12 21:22:21 +03:00
parent 244a66fa8f
commit f27c653a50
+4
View File
@@ -3,6 +3,7 @@ package gen
import (
"encoding"
"encoding/json"
"errors"
"fmt"
"reflect"
"strings"
@@ -338,6 +339,9 @@ func (g *Generator) genStructFieldDecoder(t reflect.Type, f reflect.StructField)
if tags.omit {
return nil
}
if tags.intern && tags.noCopy {
return errors.New("Mutually exclusive tags are specified: 'intern' and 'nocopy'")
}
fmt.Fprintf(g.out, " case %q:\n", jsonName)
if err := g.genTypeDecoder(f.Type, "out."+f.Name, tags, 3); err != nil {