marsevilspirit commented on code in PR #2946: URL: https://github.com/apache/dubbo-go/pull/2946#discussion_r2192456175
########## 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: Let me clarify the execution logic here. As shown in the image above, opts have the highest priority, so WithInterface has the highest priority, so it is **always** useful. The code execution flow is as follows: - Inside the cli.DialWithInfo function, the ref configuration object is initially initialized with the default interface name you pointed out. At this moment, the value of ref.InterfaceName is indeed "greet.GreetService". - Next, the program iterates over the passed opts ...client.ReferenceOption. If the user used WithInterface("custom-interface") when calling, then this Option function will be executed at this time. - Executing WithInterface will overwrite the value of ref.InterfaceName to "custom-interface". I do not want to delete this line of code, because this line of code does not only serve the new triple, the old triple may have a situation of "", unless you prove to me that the old triple will not have this problem. And I have tested the code, this function works very well. -- 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: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org