Copilot commented on code in PR #3484:
URL: https://github.com/apache/dubbo-go/pull/3484#discussion_r3568368545


##########
common/config/environment.go:
##########
@@ -138,8 +138,8 @@ func (conf *InmemoryConfiguration) GetSubProperty(subKey 
string) map[string]stru
        conf.store.Range(func(key, _ any) bool {
                if idx := strings.Index(key.(string), subKey); idx >= 0 {
                        after := key.(string)[idx+len(subKey):]
-                       if found := strings.Contains(after, "."); found {
-                               properties[after[0:strings.Index(after, ".")]] 
= struct{}{}
+                       if idx := strings.Index(after, "."); idx >= 0 {
+                               properties[after[0:idx]] = struct{}{}
                        }

Review Comment:
   The inner `idx` in `if idx := strings.Index(after, "."); ...` shadows the 
outer `idx` from the previous `strings.Index` call, which makes the control 
flow harder to read and easy to mis-edit later. Rename the inner variable to 
avoid shadowing (e.g., `dotIdx`).



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