marsevilspirit commented on code in PR #2862:
URL: https://github.com/apache/dubbo-go/pull/2862#discussion_r2077231565


##########
config/root_config.go:
##########
@@ -367,3 +372,27 @@ func (rc *RootConfig) Process(event 
*config_center.ConfigChangeEvent) {
        // dynamically update metric
        rc.Metrics.DynamicUpdateProperties(updateRootConfig.Metrics)
 }
+
+func validateRegistryAddresses(registries map[string]*RegistryConfig) error {
+       cacheKeyMap := make(map[string]string)
+
+       for id, reg := range registries {
+               address := reg.Address
+               namespace := reg.Namespace
+
+               cacheKey := address
+               if namespace != "" {
+                       cacheKey = cacheKey + "?" + constant.NacosNamespaceID + 
"=" + namespace
+               }
+
+               if existingID, exists := cacheKeyMap[cacheKey]; exists {
+                       err := fmt.Errorf("duplicate registry address: [%s] 
used by both [%s] and [%s]", cacheKey, existingID, id)
+                       logger.Error(err)

Review Comment:
   为什么不直接用logger.Errorf()?
   这会导致多引入"fmt" package



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