You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zbchi (via GitHub)" <gi...@apache.org> on 2026/01/30 13:18:27 UTC
[PR] refactor(router): replace config package [dubbo-go]
zbchi opened a new pull request, #3186:
URL: https://github.com/apache/dubbo-go/pull/3186
### Description
#2741
Migrate cluster/router and config_center/zookeeper from config package to global package.
Configuration is now passed through URL parameters instead of global singletons.
### Checklist
- [x] I confirm the target branch is `develop`
- [x] Code has passed local testing
- [x] I have added tests that prove my fix is effective or that my feature works
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3863608928
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186)
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3823740187
## [Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `64.70588%` with `6 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 48.47%. Comparing base ([`60d1c2a`](https://app.codecov.io/gh/apache/dubbo-go/commit/60d1c2a949f0ee0da4be3fe09fb79d295491e040?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`c917d22`](https://app.codecov.io/gh/apache/dubbo-go/commit/c917d2217abcf8dc23f0d6dcc1b9ecba8cb0465a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 723 commits behind head on develop.
| [Files with missing lines](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [cluster/router/condition/dynamic\_router.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?src=pr&el=tree&filepath=cluster%2Frouter%2Fcondition%2Fdynamic_router.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2R5bmFtaWNfcm91dGVyLmdv) | 57.14% | [1 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [cluster/router/condition/factory.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?src=pr&el=tree&filepath=cluster%2Frouter%2Fcondition%2Ffactory.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [config\_center/zookeeper/impl.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?src=pr&el=tree&filepath=config_center%2Fzookeeper%2Fimpl.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Y29uZmlnX2NlbnRlci96b29rZWVwZXIvaW1wbC5nbw==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## develop #3186 +/- ##
===========================================
+ Coverage 46.76% 48.47% +1.70%
===========================================
Files 295 461 +166
Lines 17172 33394 +16222
===========================================
+ Hits 8031 16188 +8157
- Misses 8287 15901 +7614
- Partials 854 1305 +451
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo-go/pull/3186?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3883922021
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186)
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3883901875
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186)
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#discussion_r2772002544
##########
global/router_config.go:
##########
@@ -53,6 +57,23 @@ type ConditionRule struct {
To []ConditionRuleTo `yaml:"to" json:"to,omitempty" property:"to"`
}
+// Equal checks if two ConditionRule instances are equal.
+// It treats nil and empty To slices as equal by comparing their lengths.
+func (x *ConditionRule) Equal(t *ConditionRule) bool {
Review Comment:
```go
// Equal checks if two ConditionRule instances are equal.
func (x *ConditionRule) Equal(t *ConditionRule) bool {
// 1. 指针地址相同或者是双 nil,直接返回真
if x == t {
return true
}
// 2. 其中一个是 nil,另一个不是,直接返回假
if x == nil || t == nil {
return false
}
// 3. 比较 From 部分
// 如果 ConditionRuleFrom 支持 == 比较,请直接使用 x.From == t.From
if !reflect.DeepEqual(x.From, t.From) {
return false
}
// 4. 比较 To 部分 (兼容 nil 与 empty)
if len(x.To) != len(t.To) {
return false
}
// 如果长度都为 0 (可能是 nil 或 []),直接过,避免后续 range
if len(x.To) == 0 {
return true
}
// 5. 循环比较元素
for i := range x.To {
// 同样,如果 ConditionRuleTo 结构简单,建议换掉 reflect.DeepEqual
if !reflect.DeepEqual(x.To[i], t.To[i]) {
return false
}
}
return true
}
```
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#discussion_r2749404420
##########
cluster/router/condition/dynamic_router.go:
##########
@@ -382,13 +388,13 @@ func (a *ApplicationRouter) Notify(invokers []base.Invoker) {
}
}
-func removeDuplicates(rules []*config.ConditionRule) {
+func removeDuplicates(rules []*global.ConditionRule) {
for i := 0; i < len(rules); i++ {
if rules[i] == nil {
continue
}
for j := i + 1; j < len(rules); j++ {
- if rules[j] != nil && rules[i].Equal(rules[j]) {
+ if rules[j] != nil && reflect.DeepEqual(rules[i], rules[j]) {
rules[j] = nil
}
Review Comment:
removeDuplicates previously used config.ConditionRule.Equal, which treats nil and empty To slices as equal (it compares len(To)). Switching to reflect.DeepEqual changes semantics: a rule with To=nil will not be considered equal to the same rule with To=[] and duplicates may remain. Consider reintroducing an explicit equality helper that matches the old behavior (compare From, compare len(To), then compare each To element) instead of reflect.DeepEqual.
##########
cluster/router/condition/route.go:
##########
@@ -439,7 +439,7 @@ func NewConditionMultiDestRouter(url *common.URL) (*MultiDestRouter, error) {
if !ok {
return nil, errors.Errorf("Condition Router can't get the rule key")
}
- condConf, ok := rawCondConf.(*config.ConditionRule)
+ condConf, ok := rawCondConf.(*global.ConditionRule)
if !ok {
return nil, errors.Errorf("Condition Router get the rule key invaild , got %T", rawCondConf)
Review Comment:
Typo in error message: "invaild" should be "invalid" (and ideally keep messages consistent across routers).
```suggestion
return nil, errors.Errorf("Condition Router get the rule key invalid , got %T", rawCondConf)
```
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#discussion_r2780305855
##########
global/router_config.go:
##########
@@ -53,6 +57,31 @@ type ConditionRule struct {
To []ConditionRuleTo `yaml:"to" json:"to,omitempty" property:"to"`
}
+// Equal checks if two ConditionRule instances are equal.
Review Comment:
```go
func (x *ConditionRule) Equal(t *ConditionRule) bool {
// 合并 nil 判断
if x == nil || t == nil {
return x == t
}
// 比较 From 字段
if !reflect.DeepEqual(x.From, t.From) {
return false
}
// 比较 To 字段的长度
if len(x.To) != len(t.To) {
return false
}
// 如果 To 字段为空,直接返回 true
if len(x.To) == 0 {
return true
}
// 遍历 To 字段的每个元素进行比较
for i := range x.To {
if !reflect.DeepEqual(x.To[i], t.To[i]) {
return false
}
}
return true
}
```
这是我让 chatgpt 改进后的代码,你瞧下哈
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "nanjiek (via GitHub)" <gi...@apache.org>.
nanjiek commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3827473824
@Alanxtl
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#discussion_r2761769783
##########
config_center/zookeeper/impl.go:
##########
@@ -73,7 +72,8 @@ func newZookeeperDynamicConfiguration(url *common.URL) (*zookeeperDynamicConfigu
rootPath: "/dubbo/config",
}
logger.Infof("[Zookeeper ConfigCenter] New Zookeeper ConfigCenter with Configuration: %+v, url = %+v", c, c.GetURL())
- if v, ok := config.GetRootConfig().ConfigCenter.Params["base64"]; ok {
+
+ if v := url.GetParam("base64", ""); v != "" {
Review Comment:
检查一下这个base64字段有没有被正确的放到url里面
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "zbchi (via GitHub)" <gi...@apache.org>.
zbchi commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3883949583
@nanjiek
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3823713843
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186)
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3830899794
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186)
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#issuecomment-3830903769
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3186&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3186&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3186&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3186)
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] refactor(router): replace config package [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3186:
URL: https://github.com/apache/dubbo-go/pull/3186#discussion_r2772002544
##########
global/router_config.go:
##########
@@ -53,6 +57,23 @@ type ConditionRule struct {
To []ConditionRuleTo `yaml:"to" json:"to,omitempty" property:"to"`
}
+// Equal checks if two ConditionRule instances are equal.
+// It treats nil and empty To slices as equal by comparing their lengths.
+func (x *ConditionRule) Equal(t *ConditionRule) bool {
Review Comment:
// Equal checks if two ConditionRule instances are equal.
func (x *ConditionRule) Equal(t *ConditionRule) bool {
// 1. 指针地址相同或者是双 nil,直接返回真
if x == t {
return true
}
// 2. 其中一个是 nil,另一个不是,直接返回假
if x == nil || t == nil {
return false
}
// 3. 比较 From 部分
// 如果 ConditionRuleFrom 支持 == 比较,请直接使用 x.From == t.From
if !reflect.DeepEqual(x.From, t.From) {
return false
}
// 4. 比较 To 部分 (兼容 nil 与 empty)
if len(x.To) != len(t.To) {
return false
}
// 如果长度都为 0 (可能是 nil 或 []),直接过,避免后续 range
if len(x.To) == 0 {
return true
}
// 5. 循环比较元素
for i := range x.To {
// 同样,如果 ConditionRuleTo 结构简单,建议换掉 reflect.DeepEqual
if !reflect.DeepEqual(x.To[i], t.To[i]) {
return false
}
}
return true
}
--
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-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org