[ https://issues.apache.org/jira/browse/THRIFT-4173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Geyer closed THRIFT-4173. ------------------------------ Fix Version/s: 0.14.0 Resolution: Cannot Reproduce > Go: thrift compiler generates wrong code for list of aliased type > ------------------------------------------------------------------ > > Key: THRIFT-4173 > URL: https://issues.apache.org/jira/browse/THRIFT-4173 > Project: Thrift > Issue Type: Bug > Components: Compiler (General) > Affects Versions: 0.10.0 > Environment: Linux amd64/Mac OS Sierra > Reporter: Andrii Degtiarov > Priority: Major > Fix For: 0.14.0 > > > Thrift code bellow produced incorrect Go code. > In the generated code {noformat}var _elem1 int8{noformat} should be > {noformat}var _elem1 StatType{noformat} and {noformat}temp := > int8(v){noformat} should be {noformat}temp := StatType(v){noformat} > Thrift: > {code} > typedef i8 StatType > struct SomeStruct { > 1: list<StatType> stats; > } > {code} > Generated code: > {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 > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)