This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/1.5 by this push:
     new fb382e3  fix bug (#1662)
fb382e3 is described below

commit fb382e3a91c8a653dfc602f5010f44a38d638023
Author: LeonXu <[email protected]>
AuthorDate: Thu Dec 23 13:14:29 2021 +0800

    fix bug (#1662)
    
    * fix: reference_config add consumer category (#1659)
    
    * fix: return error (#1661)
    
    * fix: fmt
    
    * remove consul agent testunit
---
 common/constant/key.go             |  1 +
 config/metadata_report_config.go   | 10 +++-------
 config/reference_config.go         |  1 +
 remoting/consul/test_agent_test.go | 14 --------------
 4 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/common/constant/key.go b/common/constant/key.go
index d8a66c1..887fe7a 100644
--- a/common/constant/key.go
+++ b/common/constant/key.go
@@ -132,6 +132,7 @@ const (
        CONDITION_ROUTE_PROTOCOL = "condition"
        TAG_ROUTE_PROTOCOL       = "tag"
        PROVIDERS_CATEGORY       = "providers"
+       CONSUMERS_CATEGORY       = "consumers"
        ROUTER_KEY               = "router"
        EXPORT_KEY               = "export"
 )
diff --git a/config/metadata_report_config.go b/config/metadata_report_config.go
index 6fb3fd2..6b5aa29 100644
--- a/config/metadata_report_config.go
+++ b/config/metadata_report_config.go
@@ -19,17 +19,13 @@ package config
 
 import (
        "net/url"
-)
 
-import (
        "github.com/creasty/defaults"
-       perrors "github.com/pkg/errors"
-)
 
-import (
        "github.com/apache/dubbo-go/common"
        "github.com/apache/dubbo-go/common/constant"
        "github.com/apache/dubbo-go/config/instance"
+       perrors "github.com/pkg/errors"
 )
 
 // MethodConfig is method level configuration
@@ -80,8 +76,8 @@ func (c *MetadataReportConfig) ToUrl() (*common.URL, error) {
                common.WithLocation(rc.Address),
                common.WithProtocol(c.Protocol),
        )
-       if err != nil || len(res.Protocol) == 0 {
-               return nil, perrors.New("Invalid MetadataReportConfig.")
+       if err != nil {
+               return nil, err
        }
        res.SetParam("metadata", res.Protocol)
        return res, nil
diff --git a/config/reference_config.go b/config/reference_config.go
index 48198cf..726e969 100644
--- a/config/reference_config.go
+++ b/config/reference_config.go
@@ -253,6 +253,7 @@ func (c *ReferenceConfig) getUrlMap() url.Values {
 
        urlMap.Set(constant.RELEASE_KEY, "dubbo-golang-"+constant.Version)
        urlMap.Set(constant.SIDE_KEY, (common.RoleType(common.CONSUMER)).Role())
+       urlMap.Set(constant.CATEGORY_KEY, constant.CONSUMERS_CATEGORY)
 
        if len(c.RequestTimeout) != 0 {
                urlMap.Set(constant.TIMEOUT_KEY, c.RequestTimeout)
diff --git a/remoting/consul/test_agent_test.go 
b/remoting/consul/test_agent_test.go
index 066e5e3..d51c32c 100644
--- a/remoting/consul/test_agent_test.go
+++ b/remoting/consul/test_agent_test.go
@@ -16,17 +16,3 @@
  */
 
 package consul
-
-import (
-       "testing"
-)
-
-import (
-       "github.com/stretchr/testify/assert"
-)
-
-func TestNewConsulAgent(t *testing.T) {
-       consulAgent := NewConsulAgent(t, 8500)
-       err := consulAgent.Shutdown()
-       assert.NoError(t, err)
-}

Reply via email to