Adam Beberg created THRIFT-3128:
-----------------------------------

             Summary: 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.3
         Environment: Built from git, confirmed missing prefixes in 
t_go_generator.cc
            Reporter: Adam Beberg
             Fix For: 0.9.3


=====
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)

Reply via email to