Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Consider the following structs:
struct Foo { 1: optional string foo } struct Bar { 1: optional set<Foo> foos }
This compiles into the following Go code:
type Bar struct { Foos map[*Foo]struct{} `thrift:"foos,1" db:"foos" json:"foos,omitempty"` }
Even though the generated code has tags for JSON support, Bar can't be serialized to JSON:
json: unsupported type: map[*Foo]struct {}
One solution would be to use slices, not maps, for Thrift sets. Thoughts?
Attachments
Issue Links
- Blocked
-
THRIFT-4255 Go generator has type errors when in read/write functions for set<binary>
- Closed
- incorporates
-
THRIFT-3700 Go Map has wrong default value when optional
- Closed
- links to