AlexStocks commented on code in PR #3244:
URL: https://github.com/apache/dubbo-go/pull/3244#discussion_r2934576804


##########
global/config_test.go:
##########
@@ -710,9 +710,10 @@ func TestRegistryConfigClone(t *testing.T) {
                assert.Equal(t, reg.UseAsMetaReport, cloned.UseAsMetaReport)
                assert.Equal(t, reg.UseAsConfigCenter, cloned.UseAsConfigCenter)
                assert.NotSame(t, reg, cloned)
-               assert.NotSame(t, reg.Params, cloned.Params)
                assert.Equal(t, "value1", cloned.Params["key1"])
                assert.Equal(t, "value2", cloned.Params["key2"])
+               cloned.Params["key1"] = "changed"

Review Comment:
   改进方向是对的——通过修改 clone 验证原对象不受影响,比 `NotSame` 更有意义。
   
   但建议**同时保留** `assert.NotSame`,而不是替换。两者验证的层面不同:
   - `NotSame`:clone 确实创建了新的 map/slice(指针不同)
   - 修改验证:clone 的修改不会影响原对象(深拷贝正确性)
   
   两者都保留更完整。



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