From 60b7ba595737e08f9b267215b33b489cd608dabe Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Mon, 4 Jan 2016 11:28:42 -0800 Subject: [PATCH] support structs with optional fields with num > 64 --- thrift/thrift.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/thrift/thrift.go b/thrift/thrift.go index 6b7dd34..15c05d4 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")