diff --git a/parser/types.go b/parser/types.go index 2e55b59..4346ea8 100644 --- a/parser/types.go +++ b/parser/types.go @@ -23,7 +23,7 @@ type Typedef struct { type EnumValue struct { Name string Value int - Set bool + Set bool Annotations []*Annotation } diff --git a/thrift/thrift.go b/thrift/thrift.go index 8a15f93..675693d 100644 --- a/thrift/thrift.go +++ b/thrift/thrift.go @@ -252,14 +252,15 @@ func encodeFields(t reflect.Type) structMeta { continue } id, opts := parseTag(tv) - if id >= 64 { - // TODO: figure out a better way to deal with this - panic("thrift: field id must be < 64") - } ef.id = id ef.name = f.Name ef.required = opts.Contains("required") if ef.required { + if id >= 64 { + // TODO: figure out a better way to deal with this + panic("thrift: field id must be < 64") + } + m.required |= 1 << byte(id) } ef.keepEmpty = opts.Contains("keepempty")