[ https://issues.apache.org/jira/browse/THRIFT-3128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adam Beberg updated THRIFT-3128: -------------------------------- Fix Version/s: (was: 0.9.3) > Go generated code produces name collisions between services > ----------------------------------------------------------- > > Key: THRIFT-3128 > URL: https://issues.apache.org/jira/browse/THRIFT-3128 > Project: Thrift > Issue Type: Bug > Components: Go - Compiler > Affects Versions: 0.9.2 > Environment: Built from git, confirmed missing prefixes in > t_go_generator.cc > Reporter: Adam Beberg > > ===== > Thrift file to produce problem: > ===== > namespace go BreakGo > service S1 { > i32 Ping(1:i32 i) > } > service S2 { > i32 Ping(1:i32 i) > } > ===== > Errors: > ===== > ../BreakGo/s2.go:222: PingArgs redeclared in this block > previous declaration at ../BreakGo/s1.go:222 > ../BreakGo/s2.go:226: NewPingArgs redeclared in this block > previous declaration at ../BreakGo/s1.go:226 > ../BreakGo/s2.go:230: (*PingArgs).GetI redeclared in this block > previous declaration at ../BreakGo/s1.go:230 > ../BreakGo/s2.go:233: (*PingArgs).Read redeclared in this block > previous declaration at ../BreakGo/s1.go:233 > ../BreakGo/s2.go:266: (*PingArgs).ReadField1 redeclared in this block > previous declaration at ../BreakGo/s1.go:266 > ../BreakGo/s2.go:275: (*PingArgs).Write redeclared in this block > previous declaration at ../BreakGo/s1.go:275 > ../BreakGo/s2.go:291: (*PingArgs).writeField1 redeclared in this block > previous declaration at ../BreakGo/s1.go:291 > ../BreakGo/s2.go:304: (*PingArgs).String redeclared in this block > previous declaration at ../BreakGo/s1.go:304 > ../BreakGo/s2.go:313: PingResult redeclared in this block > previous declaration at ../BreakGo/s1.go:313 > ../BreakGo/s2.go:317: NewPingResult redeclared in this block > previous declaration at ../BreakGo/s1.go:317 > ../BreakGo/s2.go:317: too many errors > ===== > Solution: Use the service name as a prefix for the *Args and *Result helper > structs, to generate S1PingArgs, S2PingArgs, S1PingResult, etc. -- This message was sent by Atlassian JIRA (v6.3.4#6332)