Skip to content

Commit

Permalink
support structs with optional fields with num > 64
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jones committed Aug 25, 2016
1 parent edbcd25 commit 4e55701
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion parser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Typedef struct {
type EnumValue struct {
Name string
Value int
Set bool
Set bool
Annotations []*Annotation
}

Expand Down
9 changes: 5 additions & 4 deletions thrift/thrift.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 4e55701

Please sign in to comment.