diff options
Diffstat (limited to 'rlp/typecache.go')
-rw-r--r-- | rlp/typecache.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/rlp/typecache.go b/rlp/typecache.go index a2f217c66..3df799e1e 100644 --- a/rlp/typecache.go +++ b/rlp/typecache.go @@ -37,11 +37,12 @@ type typeinfo struct { type tags struct { // rlp:"nil" controls whether empty input results in a nil pointer. nilOK bool - // rlp:"tail" controls whether this field swallows additional list // elements. It can only be set for the last field, which must be // of slice type. tail bool + // rlp:"-" ignores fields. + ignored bool } type typekey struct { @@ -101,6 +102,9 @@ func structFields(typ reflect.Type) (fields []field, err error) { if err != nil { return nil, err } + if tags.ignored { + continue + } info, err := cachedTypeInfo1(f.Type, tags) if err != nil { return nil, err @@ -117,6 +121,8 @@ func parseStructTag(typ reflect.Type, fi int) (tags, error) { for _, t := range strings.Split(f.Tag.Get("rlp"), ",") { switch t = strings.TrimSpace(t); t { case "": + case "-": + ts.ignored = true case "nil": ts.nilOK = true case "tail": |