You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/22 10:01:08 UTC

[GitHub] [dubbo-go] zhaoyunxing92 opened a new pull request #1479: Nacos client enhance

zhaoyunxing92 opened a new pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479


   <!--  Thanks for sending a pull request!
   Read https://github.com/apache/dubbo-go/blob/master/CONTRIBUTING.md before commit pull request.
   -->
   
   **What this PR does**:
   * Support more parameter Settings
   * nacos client init enchance
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes # https://github.com/apache/dubbo-go/issues/1478
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   ```release-note
   
   ```


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


[GitHub] [dubbo-go] zhaoyunxing92 commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r714433924



##########
File path: remoting/nacos/builder.go
##########
@@ -38,94 +36,92 @@ import (
 	"github.com/apache/dubbo-go/config"
 )
 
-// NewNacosConfigClient read the config from url and build an instance
-func NewNacosConfigClient(url *common.URL) (config_client.IConfigClient, error) {
-	nacosConfig, err := getNacosConfig(url)
+// NewNacosConfigClientByUrl reads the config from url and builds an instance
+func NewNacosConfigClientByUrl(url *common.URL) (*nacosClient.NacosConfigClient, error) {
+	sc, cc, err := GetNacosConfig(url)
 	if err != nil {
 		return nil, err
 	}
-	return clients.CreateConfigClient(nacosConfig)
+	return nacosClient.NewNacosConfigClient(getNacosClientName(), true, sc, cc)
 }
 
-// getNacosConfig will return the nacos config
-func getNacosConfig(url *common.URL) (map[string]interface{}, error) {
+// GetNacosConfig will return the nacos config
+func GetNacosConfig(url *common.URL) ([]nacosConstant.ServerConfig, nacosConstant.ClientConfig, error) {
 	if url == nil {
-		return nil, perrors.New("url is empty!")
+		return []nacosConstant.ServerConfig{}, nacosConstant.ClientConfig{}, perrors.New("url is empty!")

Review comment:
       返回值如果是指针类型可以直接nil,结构体就不行了




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


[GitHub] [dubbo-go] zouyx commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
zouyx commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713793321



##########
File path: common/url.go
##########
@@ -847,3 +848,12 @@ func SetCompareURLEqualFunc(f CompareURLEqualFunc) {
 func GetCompareURLEqualFunc() CompareURLEqualFunc {
 	return compareURLEqualFunc
 }
+
+//GetParamDuration get duration if param is invalid or missing will return 3s
+func (c *URL) GetParamDuration(s string, d string) time.Duration {
+

Review comment:
       delete blank line

##########
File path: registry/nacos/registry_test.go
##########
@@ -37,6 +37,7 @@ import (
 )
 
 func TestNacosRegistry_Register(t *testing.T) {
+	//t.Skip()

Review comment:
       delete this code?




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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3d437b) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `3.20%`.
   > The diff coverage is `71.89%`.
   
   > :exclamation: Current head d3d437b differs from pull request most recent head 33d0282. Consider uploading reports for the commit 33d0282 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   54.87%   -3.21%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15935    +2554     
   ==========================================
   + Hits         7771     8744     +973     
   - Misses       4650     6266    +1616     
   + Partials      960      925      -35     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `64.15% <0.00%> (+13.03%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [3c2aaf3...33d0282](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3d437b) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `3.20%`.
   > The diff coverage is `71.89%`.
   
   > :exclamation: Current head d3d437b differs from pull request most recent head e9530e5. Consider uploading reports for the commit e9530e5 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   54.87%   -3.21%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15935    +2554     
   ==========================================
   + Hits         7771     8744     +973     
   - Misses       4650     6266    +1616     
   + Partials      960      925      -35     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `64.15% <0.00%> (+13.03%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...e9530e5](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] Mulavar commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
Mulavar commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r715334400



##########
File path: common/constant/key.go
##########
@@ -167,27 +167,30 @@ const (
 )
 
 const (
-	NACOS_KEY                    = "nacos"
-	NACOS_DEFAULT_ROLETYPE       = 3
-	NACOS_CACHE_DIR_KEY          = "cacheDir"
-	NACOS_LOG_DIR_KEY            = "logDir"
-	NACOS_BEAT_INTERVAL_KEY      = "beatInterval"
-	NACOS_ENDPOINT               = "endpoint"
-	NACOS_SERVICE_NAME_SEPARATOR = ":"
-	NACOS_CATEGORY_KEY           = "category"
-	NACOS_PROTOCOL_KEY           = "protocol"
-	NACOS_PATH_KEY               = "path"
-	NACOS_NAMESPACE_ID           = "namespaceId"
-	NACOS_PASSWORD               = "password"
-	NACOS_USERNAME               = "username"
-	NACOS_NOT_LOAD_LOCAL_CACHE   = "nacos.not.load.cache"
-	NACOS_APP_NAME_KEY           = "appName"
-	NACOS_REGION_ID_KEY          = "regionId"
-	NACOS_ACCESS_KEY             = "access"
-	NACOS_SECRET_KEY             = "secret"
-	NACOS_OPEN_KMS_KEY           = "kms"
-	NACOS_UPDATE_THREAD_NUM_KEY  = "updateThreadNum"
-	NACOS_LOG_LEVEL_KEY          = "logLevel"
+	NACOS_KEY                     = "nacos"
+	NACOS_DEFAULT_ROLETYPE        = 3
+	NACOS_CACHE_DIR_KEY           = "cacheDir"
+	NACOS_LOG_DIR_KEY             = "logDir"
+	NACOS_BEAT_INTERVAL_KEY       = "beatInterval"
+	NACOS_ENDPOINT                = "endpoint"
+	NACOS_SERVICE_NAME_SEPARATOR  = ":"
+	NACOS_CATEGORY_KEY            = "category"
+	NACOS_PROTOCOL_KEY            = "protocol"
+	NACOS_PATH_KEY                = "path"
+	NACOS_NAMESPACE_ID            = "namespaceId"
+	NACOS_PASSWORD                = "password"
+	NACOS_USERNAME                = "username"
+	NACOS_NOT_LOAD_LOCAL_CACHE    = "nacos.not.load.cache"
+	NACOS_APP_NAME_KEY            = "appName"
+	NACOS_REGION_ID_KEY           = "regionId"
+	NACOS_ACCESS_KEY              = "access"
+	NACOS_SECRET_KEY              = "secret"
+	NACOS_OPEN_KMS_KEY            = "kms"
+	NACOS_UPDATE_THREAD_NUM_KEY   = "updateThreadNum"
+	NACOS_LOG_LEVEL_KEY           = "logLevel"
+	NACOS_Update_Cache_When_Empty = "updateCacheWhenEmpty"

Review comment:
       这里常量名的命名方式和其他不一致

##########
File path: common/constant/key.go
##########
@@ -167,27 +167,30 @@ const (
 )
 
 const (
-	NACOS_KEY                    = "nacos"
-	NACOS_DEFAULT_ROLETYPE       = 3
-	NACOS_CACHE_DIR_KEY          = "cacheDir"
-	NACOS_LOG_DIR_KEY            = "logDir"
-	NACOS_BEAT_INTERVAL_KEY      = "beatInterval"
-	NACOS_ENDPOINT               = "endpoint"
-	NACOS_SERVICE_NAME_SEPARATOR = ":"
-	NACOS_CATEGORY_KEY           = "category"
-	NACOS_PROTOCOL_KEY           = "protocol"
-	NACOS_PATH_KEY               = "path"
-	NACOS_NAMESPACE_ID           = "namespaceId"
-	NACOS_PASSWORD               = "password"
-	NACOS_USERNAME               = "username"
-	NACOS_NOT_LOAD_LOCAL_CACHE   = "nacos.not.load.cache"
-	NACOS_APP_NAME_KEY           = "appName"
-	NACOS_REGION_ID_KEY          = "regionId"
-	NACOS_ACCESS_KEY             = "access"
-	NACOS_SECRET_KEY             = "secret"
-	NACOS_OPEN_KMS_KEY           = "kms"
-	NACOS_UPDATE_THREAD_NUM_KEY  = "updateThreadNum"
-	NACOS_LOG_LEVEL_KEY          = "logLevel"
+	NACOS_KEY                     = "nacos"
+	NACOS_DEFAULT_ROLETYPE        = 3
+	NACOS_CACHE_DIR_KEY           = "cacheDir"
+	NACOS_LOG_DIR_KEY             = "logDir"
+	NACOS_BEAT_INTERVAL_KEY       = "beatInterval"
+	NACOS_ENDPOINT                = "endpoint"
+	NACOS_SERVICE_NAME_SEPARATOR  = ":"
+	NACOS_CATEGORY_KEY            = "category"
+	NACOS_PROTOCOL_KEY            = "protocol"
+	NACOS_PATH_KEY                = "path"
+	NACOS_NAMESPACE_ID            = "namespaceId"
+	NACOS_PASSWORD                = "password"
+	NACOS_USERNAME                = "username"
+	NACOS_NOT_LOAD_LOCAL_CACHE    = "nacos.not.load.cache"
+	NACOS_APP_NAME_KEY            = "appName"
+	NACOS_REGION_ID_KEY           = "regionId"
+	NACOS_ACCESS_KEY              = "access"
+	NACOS_SECRET_KEY              = "secret"
+	NACOS_OPEN_KMS_KEY            = "kms"
+	NACOS_UPDATE_THREAD_NUM_KEY   = "updateThreadNum"
+	NACOS_LOG_LEVEL_KEY           = "logLevel"
+	NACOS_Update_Cache_When_Empty = "updateCacheWhenEmpty"
+	NACOS_LOG_MAX_AGE             = "maxAge"
+	NACOS_LOG_Rotate_Time         = "rotateTime"

Review comment:
       同上




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


[GitHub] [dubbo-go] wenxuwan commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713918333



##########
File path: config_center/nacos/client.go
##########
@@ -18,173 +18,63 @@
 package nacos
 
 import (
-	"strconv"
-	"strings"
 	"sync"
 	"time"
 )
 
 import (
-	"github.com/nacos-group/nacos-sdk-go/clients"
-	"github.com/nacos-group/nacos-sdk-go/clients/config_client"
-	nacosconst "github.com/nacos-group/nacos-sdk-go/common/constant"
+	nacosClient "github.com/dubbogo/gost/database/kv/nacos"
 	perrors "github.com/pkg/errors"
 )
 
 import (
-	"github.com/apache/dubbo-go/common"
-	"github.com/apache/dubbo-go/common/constant"
 	"github.com/apache/dubbo-go/common/logger"
+	"github.com/apache/dubbo-go/remoting/nacos"
 )
 
-// NacosClient Nacos client
+// NacosClient Nacos configClient
 type NacosClient struct {
-	name       string
-	NacosAddrs []string
-	sync.Mutex // for Client
-	client     *config_client.IConfigClient
-	exit       chan struct{}
-	Timeout    time.Duration
-	once       sync.Once
-	onceClose  func()
+	name         string
+	NacosAddrs   []string
+	sync.Mutex   // for Client
+	configClient *nacosClient.NacosConfigClient
+	exit         chan struct{}
+	Timeout      time.Duration
+	once         sync.Once
+	onceClose    func()
 }
 
 // Client Get Client
-func (n *NacosClient) Client() *config_client.IConfigClient {
-	return n.client
+func (n *NacosClient) Client() *nacosClient.NacosConfigClient {
+	return n.configClient

Review comment:
       Get client should use lock just same with SetClient




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


[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713897597



##########
File path: remoting/nacos/builder.go
##########
@@ -38,94 +36,92 @@ import (
 	"github.com/apache/dubbo-go/config"
 )
 
-// NewNacosConfigClient read the config from url and build an instance
-func NewNacosConfigClient(url *common.URL) (config_client.IConfigClient, error) {
-	nacosConfig, err := getNacosConfig(url)
+// NewNacosConfigClientByUrl read the config from url and build an instance

Review comment:
       NewNacosConfigClientByUrl reads the config from url and builds an instance




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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5f59ca1) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `2.05%`.
   > The diff coverage is `73.59%`.
   
   > :exclamation: Current head 5f59ca1 differs from pull request most recent head 4f78b0b. Consider uploading reports for the commit 4f78b0b to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   56.01%   -2.06%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15933    +2552     
   ==========================================
   + Hits         7771     8925    +1154     
   - Misses       4650     6069    +1419     
   + Partials      960      939      -21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `54.71% <0.00%> (+3.60%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...4f78b0b](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5f59ca1) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `2.05%`.
   > The diff coverage is `73.59%`.
   
   > :exclamation: Current head 5f59ca1 differs from pull request most recent head d0cc593. Consider uploading reports for the commit d0cc593 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   56.01%   -2.06%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15933    +2552     
   ==========================================
   + Hits         7771     8925    +1154     
   - Misses       4650     6069    +1419     
   + Partials      960      939      -21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `54.71% <0.00%> (+3.60%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...d0cc593](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] wenxuwan commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r714465746



##########
File path: config_center/nacos/client.go
##########
@@ -18,173 +18,63 @@
 package nacos
 
 import (
-	"strconv"
-	"strings"
 	"sync"
 	"time"
 )
 
 import (
-	"github.com/nacos-group/nacos-sdk-go/clients"
-	"github.com/nacos-group/nacos-sdk-go/clients/config_client"
-	nacosconst "github.com/nacos-group/nacos-sdk-go/common/constant"
+	nacosClient "github.com/dubbogo/gost/database/kv/nacos"
 	perrors "github.com/pkg/errors"
 )
 
 import (
-	"github.com/apache/dubbo-go/common"
-	"github.com/apache/dubbo-go/common/constant"
 	"github.com/apache/dubbo-go/common/logger"
+	"github.com/apache/dubbo-go/remoting/nacos"
 )
 
-// NacosClient Nacos client
+// NacosClient Nacos configClient
 type NacosClient struct {
-	name       string
-	NacosAddrs []string
-	sync.Mutex // for Client
-	client     *config_client.IConfigClient
-	exit       chan struct{}
-	Timeout    time.Duration
-	once       sync.Once
-	onceClose  func()
+	name         string
+	NacosAddrs   []string
+	sync.Mutex   // for Client
+	configClient *nacosClient.NacosConfigClient
+	exit         chan struct{}
+	Timeout      time.Duration
+	once         sync.Once
+	onceClose    func()
 }
 
 // Client Get Client
-func (n *NacosClient) Client() *config_client.IConfigClient {
-	return n.client
+func (n *NacosClient) Client() *nacosClient.NacosConfigClient {
+	return n.configClient
 }
 
-// SetClient Set client
-func (n *NacosClient) SetClient(client *config_client.IConfigClient) {
+// SetClient Set configClient
+func (n *NacosClient) SetClient(configClient *nacosClient.NacosConfigClient) {
 	n.Lock()
-	n.client = client
+	n.configClient = configClient
 	n.Unlock()
 }
 
-type option func(*options)
-
-type options struct {
-	nacosName string
-	//client    *NacosClient
-}
-
-// WithNacosName Set nacos name
-func WithNacosName(name string) option {
-	return func(opt *options) {
-		opt.nacosName = name
-	}
-}
-
-// ValidateNacosClient Validate nacos client , if null then create it
-func ValidateNacosClient(container nacosClientFacade, opts ...option) error {
+// ValidateNacosClient Validate nacos configClient , if null then create it
+func ValidateNacosClient(container nacosClientFacade) error {
 	if container == nil {
 		return perrors.Errorf("container can not be null")
 	}
-	os := &options{}
-	for _, opt := range opts {
-		opt(os)
-	}
-
 	url := container.GetURL()
-	timeout, err := time.ParseDuration(url.GetParam(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT))
-	if err != nil {
-		logger.Errorf("invalid timeout config %+v,got err %+v",
-			url.GetParam(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT), err)
-		return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
-	}
-	nacosAddresses := strings.Split(url.Location, ",")
-	if container.NacosClient() == nil {
-		//in dubbo ,every registry only connect one node ,so this is []string{r.Address}
-		newClient, err := newNacosClient(os.nacosName, nacosAddresses, timeout, url)
+	if container.NacosClient() == nil || container.NacosClient().Client() == nil {
+		// in dubbo ,every registry only connect one node ,so this is []string{r.Address}
+		newClient, err := nacos.NewNacosConfigClientByUrl(url)
 		if err != nil {
-			logger.Errorf("newNacosClient(name{%s}, nacos address{%v}, timeout{%d}) = error{%v}",
-				os.nacosName, url.Location, timeout.String(), err)
+			logger.Errorf("ValidateNacosClient(name{%s}, nacos address{%v} = error{%v}", url.Location, err)
 			return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
 		}
 		container.SetNacosClient(newClient)
 	}
-
-	if container.NacosClient().Client() == nil {
-		configClient, err := initNacosConfigClient(nacosAddresses, timeout, url)
-		if err != nil {
-			logger.Errorf("initNacosConfigClient(addr:%+v,timeout:%v,url:%v) = err %+v",
-				nacosAddresses, timeout.String(), url, err)
-			return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
-		}
-		container.NacosClient().SetClient(&configClient)
-
-	}
-
 	return perrors.WithMessagef(nil, "newNacosClient(address:%+v)", url.PrimitiveURL)

Review comment:
       perrors.WithMessagef 这个函数的实现你可以看一下,本身就会判断err是不是nil,是nil的话直接返回了nil,这里直接返回nil,没必要再包一层,看着跟返回了一个errror一样




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


[GitHub] [dubbo-go] wenxuwan commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713915673



##########
File path: config/remote_config.go
##########
@@ -45,7 +46,7 @@ type RemoteConfig struct {
 }
 
 // Prefix
-func (c *RemoteConfig) Prefix() string {
+func (RemoteConfig) Prefix() string {
 	return constant.RemotePrefix

Review comment:
       If it is not a member function, just use constant.RemotePrefix directly




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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (05034bb) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `1.92%`.
   > The diff coverage is `73.33%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   56.14%   -1.93%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15935    +2554     
   ==========================================
   + Hits         7771     8947    +1176     
   - Misses       4650     6047    +1397     
   + Partials      960      941      -19     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `54.71% <0.00%> (+3.60%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...05034bb](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] wenxuwan commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r714464692



##########
File path: config/remote_config.go
##########
@@ -45,7 +46,7 @@ type RemoteConfig struct {
 }
 
 // Prefix
-func (c *RemoteConfig) Prefix() string {
+func (RemoteConfig) Prefix() string {
 	return constant.RemotePrefix

Review comment:
       保留的意义是什么,返回一个public的const变量吗




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


[GitHub] [dubbo-go] cjphaha commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
cjphaha commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713953180



##########
File path: remoting/nacos/builder.go
##########
@@ -38,94 +36,92 @@ import (
 	"github.com/apache/dubbo-go/config"
 )
 
-// NewNacosConfigClient read the config from url and build an instance
-func NewNacosConfigClient(url *common.URL) (config_client.IConfigClient, error) {
-	nacosConfig, err := getNacosConfig(url)
+// NewNacosConfigClientByUrl reads the config from url and builds an instance
+func NewNacosConfigClientByUrl(url *common.URL) (*nacosClient.NacosConfigClient, error) {
+	sc, cc, err := GetNacosConfig(url)
 	if err != nil {
 		return nil, err
 	}
-	return clients.CreateConfigClient(nacosConfig)
+	return nacosClient.NewNacosConfigClient(getNacosClientName(), true, sc, cc)
 }
 
-// getNacosConfig will return the nacos config
-func getNacosConfig(url *common.URL) (map[string]interface{}, error) {
+// GetNacosConfig will return the nacos config
+func GetNacosConfig(url *common.URL) ([]nacosConstant.ServerConfig, nacosConstant.ClientConfig, error) {
 	if url == nil {
-		return nil, perrors.New("url is empty!")
+		return []nacosConstant.ServerConfig{}, nacosConstant.ClientConfig{}, perrors.New("url is empty!")

Review comment:
       why not return nil directly




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


[GitHub] [dubbo-go] zhaoyunxing92 commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r714433506



##########
File path: config/remote_config.go
##########
@@ -45,7 +46,7 @@ type RemoteConfig struct {
 }
 
 // Prefix
-func (c *RemoteConfig) Prefix() string {
+func (RemoteConfig) Prefix() string {
 	return constant.RemotePrefix

Review comment:
       我感觉先保留




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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a4b4f50) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `2.34%`.
   > The diff coverage is `63.06%`.
   
   > :exclamation: Current head a4b4f50 differs from pull request most recent head 33d0282. Consider uploading reports for the commit 33d0282 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   55.72%   -2.35%     
   ==========================================
     Files         275      279       +4     
     Lines       13381    16024    +2643     
   ==========================================
   + Hits         7771     8930    +1159     
   - Misses       4650     6153    +1503     
   + Partials      960      941      -19     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_load\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfbG9hZF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `57.30% <0.00%> (+3.01%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `64.15% <0.00%> (+13.03%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | ... and [323 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [3c2aaf3...33d0282](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] codecov-commenter commented on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5f59ca1) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `2.05%`.
   > The diff coverage is `73.59%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   56.01%   -2.06%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15933    +2552     
   ==========================================
   + Hits         7771     8925    +1154     
   - Misses       4650     6069    +1419     
   + Partials      960      939      -21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `54.71% <0.00%> (+3.60%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...5f59ca1](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] wenxuwan commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713915673



##########
File path: config/remote_config.go
##########
@@ -45,7 +46,7 @@ type RemoteConfig struct {
 }
 
 // Prefix
-func (c *RemoteConfig) Prefix() string {
+func (RemoteConfig) Prefix() string {
 	return constant.RemotePrefix

Review comment:
       If it is not a member function, remove RemoteConfig




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


[GitHub] [dubbo-go] zhaoyunxing92 commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r714434333



##########
File path: config_center/nacos/client.go
##########
@@ -18,173 +18,63 @@
 package nacos
 
 import (
-	"strconv"
-	"strings"
 	"sync"
 	"time"
 )
 
 import (
-	"github.com/nacos-group/nacos-sdk-go/clients"
-	"github.com/nacos-group/nacos-sdk-go/clients/config_client"
-	nacosconst "github.com/nacos-group/nacos-sdk-go/common/constant"
+	nacosClient "github.com/dubbogo/gost/database/kv/nacos"
 	perrors "github.com/pkg/errors"
 )
 
 import (
-	"github.com/apache/dubbo-go/common"
-	"github.com/apache/dubbo-go/common/constant"
 	"github.com/apache/dubbo-go/common/logger"
+	"github.com/apache/dubbo-go/remoting/nacos"
 )
 
-// NacosClient Nacos client
+// NacosClient Nacos configClient
 type NacosClient struct {
-	name       string
-	NacosAddrs []string
-	sync.Mutex // for Client
-	client     *config_client.IConfigClient
-	exit       chan struct{}
-	Timeout    time.Duration
-	once       sync.Once
-	onceClose  func()
+	name         string
+	NacosAddrs   []string
+	sync.Mutex   // for Client
+	configClient *nacosClient.NacosConfigClient
+	exit         chan struct{}
+	Timeout      time.Duration
+	once         sync.Once
+	onceClose    func()
 }
 
 // Client Get Client
-func (n *NacosClient) Client() *config_client.IConfigClient {
-	return n.client
+func (n *NacosClient) Client() *nacosClient.NacosConfigClient {
+	return n.configClient
 }
 
-// SetClient Set client
-func (n *NacosClient) SetClient(client *config_client.IConfigClient) {
+// SetClient Set configClient
+func (n *NacosClient) SetClient(configClient *nacosClient.NacosConfigClient) {
 	n.Lock()
-	n.client = client
+	n.configClient = configClient
 	n.Unlock()
 }
 
-type option func(*options)
-
-type options struct {
-	nacosName string
-	//client    *NacosClient
-}
-
-// WithNacosName Set nacos name
-func WithNacosName(name string) option {
-	return func(opt *options) {
-		opt.nacosName = name
-	}
-}
-
-// ValidateNacosClient Validate nacos client , if null then create it
-func ValidateNacosClient(container nacosClientFacade, opts ...option) error {
+// ValidateNacosClient Validate nacos configClient , if null then create it
+func ValidateNacosClient(container nacosClientFacade) error {
 	if container == nil {
 		return perrors.Errorf("container can not be null")
 	}
-	os := &options{}
-	for _, opt := range opts {
-		opt(os)
-	}
-
 	url := container.GetURL()
-	timeout, err := time.ParseDuration(url.GetParam(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT))
-	if err != nil {
-		logger.Errorf("invalid timeout config %+v,got err %+v",
-			url.GetParam(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT), err)
-		return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
-	}
-	nacosAddresses := strings.Split(url.Location, ",")
-	if container.NacosClient() == nil {
-		//in dubbo ,every registry only connect one node ,so this is []string{r.Address}
-		newClient, err := newNacosClient(os.nacosName, nacosAddresses, timeout, url)
+	if container.NacosClient() == nil || container.NacosClient().Client() == nil {
+		// in dubbo ,every registry only connect one node ,so this is []string{r.Address}
+		newClient, err := nacos.NewNacosConfigClientByUrl(url)
 		if err != nil {
-			logger.Errorf("newNacosClient(name{%s}, nacos address{%v}, timeout{%d}) = error{%v}",
-				os.nacosName, url.Location, timeout.String(), err)
+			logger.Errorf("ValidateNacosClient(name{%s}, nacos address{%v} = error{%v}", url.Location, err)
 			return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
 		}
 		container.SetNacosClient(newClient)
 	}
-
-	if container.NacosClient().Client() == nil {
-		configClient, err := initNacosConfigClient(nacosAddresses, timeout, url)
-		if err != nil {
-			logger.Errorf("initNacosConfigClient(addr:%+v,timeout:%v,url:%v) = err %+v",
-				nacosAddresses, timeout.String(), url, err)
-			return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
-		}
-		container.NacosClient().SetClient(&configClient)
-
-	}
-
 	return perrors.WithMessagef(nil, "newNacosClient(address:%+v)", url.PrimitiveURL)

Review comment:
       使用这个方法的地方对error判空了,不能直接返回nil




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


[GitHub] [dubbo-go] zhaoyunxing92 merged pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 merged pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479


   


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


[GitHub] [dubbo-go] wenxuwan commented on a change in pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on a change in pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#discussion_r713921815



##########
File path: config_center/nacos/client.go
##########
@@ -18,173 +18,63 @@
 package nacos
 
 import (
-	"strconv"
-	"strings"
 	"sync"
 	"time"
 )
 
 import (
-	"github.com/nacos-group/nacos-sdk-go/clients"
-	"github.com/nacos-group/nacos-sdk-go/clients/config_client"
-	nacosconst "github.com/nacos-group/nacos-sdk-go/common/constant"
+	nacosClient "github.com/dubbogo/gost/database/kv/nacos"
 	perrors "github.com/pkg/errors"
 )
 
 import (
-	"github.com/apache/dubbo-go/common"
-	"github.com/apache/dubbo-go/common/constant"
 	"github.com/apache/dubbo-go/common/logger"
+	"github.com/apache/dubbo-go/remoting/nacos"
 )
 
-// NacosClient Nacos client
+// NacosClient Nacos configClient
 type NacosClient struct {
-	name       string
-	NacosAddrs []string
-	sync.Mutex // for Client
-	client     *config_client.IConfigClient
-	exit       chan struct{}
-	Timeout    time.Duration
-	once       sync.Once
-	onceClose  func()
+	name         string
+	NacosAddrs   []string
+	sync.Mutex   // for Client
+	configClient *nacosClient.NacosConfigClient
+	exit         chan struct{}
+	Timeout      time.Duration
+	once         sync.Once
+	onceClose    func()
 }
 
 // Client Get Client
-func (n *NacosClient) Client() *config_client.IConfigClient {
-	return n.client
+func (n *NacosClient) Client() *nacosClient.NacosConfigClient {
+	return n.configClient
 }
 
-// SetClient Set client
-func (n *NacosClient) SetClient(client *config_client.IConfigClient) {
+// SetClient Set configClient
+func (n *NacosClient) SetClient(configClient *nacosClient.NacosConfigClient) {
 	n.Lock()
-	n.client = client
+	n.configClient = configClient
 	n.Unlock()
 }
 
-type option func(*options)
-
-type options struct {
-	nacosName string
-	//client    *NacosClient
-}
-
-// WithNacosName Set nacos name
-func WithNacosName(name string) option {
-	return func(opt *options) {
-		opt.nacosName = name
-	}
-}
-
-// ValidateNacosClient Validate nacos client , if null then create it
-func ValidateNacosClient(container nacosClientFacade, opts ...option) error {
+// ValidateNacosClient Validate nacos configClient , if null then create it
+func ValidateNacosClient(container nacosClientFacade) error {
 	if container == nil {
 		return perrors.Errorf("container can not be null")
 	}
-	os := &options{}
-	for _, opt := range opts {
-		opt(os)
-	}
-
 	url := container.GetURL()
-	timeout, err := time.ParseDuration(url.GetParam(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT))
-	if err != nil {
-		logger.Errorf("invalid timeout config %+v,got err %+v",
-			url.GetParam(constant.CONFIG_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT), err)
-		return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
-	}
-	nacosAddresses := strings.Split(url.Location, ",")
-	if container.NacosClient() == nil {
-		//in dubbo ,every registry only connect one node ,so this is []string{r.Address}
-		newClient, err := newNacosClient(os.nacosName, nacosAddresses, timeout, url)
+	if container.NacosClient() == nil || container.NacosClient().Client() == nil {
+		// in dubbo ,every registry only connect one node ,so this is []string{r.Address}
+		newClient, err := nacos.NewNacosConfigClientByUrl(url)
 		if err != nil {
-			logger.Errorf("newNacosClient(name{%s}, nacos address{%v}, timeout{%d}) = error{%v}",
-				os.nacosName, url.Location, timeout.String(), err)
+			logger.Errorf("ValidateNacosClient(name{%s}, nacos address{%v} = error{%v}", url.Location, err)
 			return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
 		}
 		container.SetNacosClient(newClient)
 	}
-
-	if container.NacosClient().Client() == nil {
-		configClient, err := initNacosConfigClient(nacosAddresses, timeout, url)
-		if err != nil {
-			logger.Errorf("initNacosConfigClient(addr:%+v,timeout:%v,url:%v) = err %+v",
-				nacosAddresses, timeout.String(), url, err)
-			return perrors.WithMessagef(err, "newNacosClient(address:%+v)", url.Location)
-		}
-		container.NacosClient().SetClient(&configClient)
-
-	}
-
 	return perrors.WithMessagef(nil, "newNacosClient(address:%+v)", url.PrimitiveURL)

Review comment:
       here return nil is better




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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4f78b0b) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `2.00%`.
   > The diff coverage is `73.59%`.
   
   > :exclamation: Current head 4f78b0b differs from pull request most recent head 05034bb. Consider uploading reports for the commit 05034bb to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   56.06%   -2.01%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15933    +2552     
   ==========================================
   + Hits         7771     8933    +1162     
   - Misses       4650     6061    +1411     
   + Partials      960      939      -21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `64.15% <0.00%> (+13.03%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...05034bb](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #1479: Nacos client enhance

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1479:
URL: https://github.com/apache/dubbo-go/pull/1479#issuecomment-924880082


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1479](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (05034bb) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/467c867e04f7d28308305b7601e391080fa73340?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (467c867) will **decrease** coverage by `1.92%`.
   > The diff coverage is `73.33%`.
   
   > :exclamation: Current head 05034bb differs from pull request most recent head d3d437b. Consider uploading reports for the commit d3d437b to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/1479/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5    #1479      +/-   ##
   ==========================================
   - Coverage   58.07%   56.14%   -1.93%     
   ==========================================
     Files         275      278       +3     
     Lines       13381    15935    +2554     
   ==========================================
   + Hits         7771     8947    +1176     
   - Misses       4650     6047    +1397     
   + Partials      960      941      -19     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [common/extension/config\_post\_processor.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25maWdfcG9zdF9wcm9jZXNzb3IuZ28=) | `0.00% <0.00%> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `61.57% <0.00%> (+1.57%)` | :arrow_up: |
   | [config/graceful\_shutdown.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL2dyYWNlZnVsX3NodXRkb3duLmdv) | `55.43% <0.00%> (+1.14%)` | :arrow_up: |
   | [config/provider\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29uZmlnL3Byb3ZpZGVyX2NvbmZpZy5nbw==) | `62.06% <0.00%> (+7.52%)` | :arrow_up: |
   | [registry/consul/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvY29uc3VsL3JlZ2lzdHJ5Lmdv) | `51.64% <0.00%> (+2.31%)` | :arrow_up: |
   | [...gistry/event/protocol\_ports\_metadata\_customizer.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvZXZlbnQvcHJvdG9jb2xfcG9ydHNfbWV0YWRhdGFfY3VzdG9taXplci5nbw==) | `65.78% <ø> (+6.41%)` | :arrow_up: |
   | [registry/kubernetes/registry.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkva3ViZXJuZXRlcy9yZWdpc3RyeS5nbw==) | `54.71% <0.00%> (+3.60%)` | :arrow_up: |
   | [registry/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVnaXN0cnkvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `26.58% <0.00%> (-42.65%)` | :arrow_down: |
   | [remoting/etcdv3/client.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2NsaWVudC5nbw==) | `55.69% <0.00%> (+2.69%)` | :arrow_up: |
   | [remoting/etcdv3/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3RpbmcvZXRjZHYzL2ZhY2FkZS5nbw==) | `0.00% <0.00%> (ø)` | |
   | ... and [321 more](https://codecov.io/gh/apache/dubbo-go/pull/1479/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5104d50...d3d437b](https://codecov.io/gh/apache/dubbo-go/pull/1479?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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