loopholelabs/frpc-go

RPC Methods Cannot Have the Same Name

ShivanshVij opened this issue · 0 comments

When we create the following proto file:

service MyService {
  rpc MyMethod(MyRequest) returns (MyResponse) {}
}

service MyOtherService {
  rpc MyMethod(MyRequest) returns (MyResponse) {}
}

This is a completely valid proto3 file, however we always coalesce the RPC Services into a single service on the client-side. Because of this (and because the names of the Methods are the same), our generated client ends up with the same method being created for it:

Screen Shot 2022-08-24 at 3.26.11 PM.png

This is bad, and the easiest way around this is to create "subclients":

c := NewClient()
c.MyOtherService.MyMethod()
c.MyService.MyMethod()

Just an empty struct should be fine for this.