Alanxtl commented on code in PR #2946:
URL: https://github.com/apache/dubbo-go/pull/2946#discussion_r2191660502


##########
client/action.go:
##########
@@ -107,7 +107,9 @@ func (refOpts *ReferenceOptions) refer(srv 
common.RPCService, info *ClientInfo)
 
        var methods []string
        if info != nil {
-               ref.InterfaceName = info.InterfaceName
+               if ref.InterfaceName == "" {
+                       ref.InterfaceName = info.InterfaceName
+               }

Review Comment:
   the default value of `ref.InterfaceName` sets to `package.service` in IDL 
generated file, instead of "".
   
   for example in `dubbo-go-samples/helloworld/proto/greet.triple.go`
   ```go
   // NewGreetService constructs a client for the greet.GreetService service.
   func NewGreetService(cli *client.Client, opts ...client.ReferenceOption) 
(GreetService, error) {
        conn, err := cli.DialWithInfo("greet.GreetService", 
&GreetService_ClientInfo, opts...)
        if err != nil {
                return nil, err
        }
        return &GreetServiceImpl{
                conn: conn,
        }, nil
   }
   ```
   
   the first value of `cli.DialWithInfo` passed in as `ref.InterfaceName`, so 
`ref.InterfaceName` is always equals to  `info.InterfaceName` if not using your 
`WithInterface`, and if use `WithInterface` `ref.InterfaceName` is always 
overwritten by  `info.InterfaceName`, makes `WithInterface` always useless, 
what about just delete this line



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to