Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
0.10.0
-
None
-
Linux amd64/Mac OS Sierra
Description
Thrift code bellow produced incorrect Go code.
In the generated code
var _elem1 int8
should be
var _elem1 StatType
and
temp := int8(v)
should be
temp := StatType(v)
Thrift:
typedef i8 StatType struct SomeStruct { 1: list<StatType> stats; }
Generated code:
func (p *CSVAnalyzeTaskPayload) ReadField1(iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin() if err != nil { return thrift.PrependError("error reading list begin: ", err) } tSlice := make([]StatType, 0, size) p.Stats = tSlice for i := 0; i < size; i ++ { var _elem1 int8 if v, err := iprot.ReadByte(); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := int8(v) _elem1 = temp } p.Stats = append(p.Stats, _elem1) } if err := iprot.ReadListEnd(); err != nil { return thrift.PrependError("error reading list end: ", err) } return nil }
Attachments
Issue Links
- is duplicated by
-
THRIFT-4195 Compilation to GO produces broken code
- Closed