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

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


The following commit(s) were added to refs/heads/3.0 by this push:
     new b534f751b upgrade nacos v2 (#2116)
b534f751b is described below

commit b534f751b614d79201070f47046a4fbf9dcce7d9
Author: binbin.zhang <[email protected]>
AuthorDate: Fri Nov 11 21:18:17 2022 +0800

    upgrade nacos v2 (#2116)
---
 cluster/cluster/available/cluster_invoker_test.go |  6 +-
 cluster/cluster/broadcast/cluster_invoker_test.go | 10 +--
 cluster/cluster/failback/cluster_test.go          | 28 ++++----
 cluster/cluster/failfast/cluster_test.go          | 10 +--
 cluster/cluster/failsafe/cluster_test.go          | 10 +--
 cluster/cluster/forking/cluster_test.go           | 18 ++---
 cluster/cluster/zoneaware/cluster_invoker_test.go | 28 ++++----
 common/host_util.go                               |  4 ++
 common/host_util_test.go                          |  6 +-
 config_center/nacos/impl.go                       |  4 +-
 config_center/nacos/impl_test.go                  |  9 ++-
 config_center/nacos/listener.go                   |  4 +-
 filter/active/filter_test.go                      |  6 +-
 filter/auth/consumer_sign_filter_test.go          |  4 +-
 filter/auth/provider_auth_filter_test.go          |  4 +-
 filter/generic/filter_test.go                     | 12 ++--
 filter/generic/service_filter_test.go             | 12 ++--
 go.mod                                            |  2 +-
 go.sum                                            |  6 +-
 metadata/report/nacos/report.go                   |  2 +-
 metadata/report/nacos/report_test.go              |  8 ++-
 protocol/mock/mock_invoker.go                     | 80 +++++++++++++----------
 registry/nacos/listener.go                        | 25 ++-----
 registry/nacos/registry.go                        |  2 +-
 registry/nacos/registry_test.go                   |  8 ++-
 registry/nacos/service_discovery.go               |  6 +-
 registry/nacos/service_discovery_test.go          |  7 +-
 registry/zookeeper/service_discovery_test.go      |  4 +-
 remoting/nacos/builder.go                         |  2 +-
 remoting/nacos/builder_test.go                    |  2 +-
 30 files changed, 171 insertions(+), 158 deletions(-)

diff --git a/cluster/cluster/available/cluster_invoker_test.go 
b/cluster/cluster/available/cluster_invoker_test.go
index cf20230e0..0d18d209a 100644
--- a/cluster/cluster/available/cluster_invoker_test.go
+++ b/cluster/cluster/available/cluster_invoker_test.go
@@ -52,7 +52,7 @@ func registerAvailable(invoker *mock.MockInvoker) 
protocol.Invoker {
 
        invokers := []protocol.Invoker{}
        invokers = append(invokers, invoker)
-       invoker.EXPECT().GetUrl().Return(availableUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(availableUrl).AnyTimes()
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
        staticDir := static.NewDirectory(invokers)
@@ -69,7 +69,7 @@ func TestAvailableClusterInvokerSuccess(t *testing.T) {
 
        mockResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, 
Success: true}}
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
 
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
 
@@ -86,7 +86,7 @@ func TestAvailableClusterInvokerNoAvail(t *testing.T) {
        invoker.EXPECT().IsAvailable().Return(false).AnyTimes()
 
        res := &protocol.RPCResult{Err: errors.New("no provider available")}
-       invoker.EXPECT().Invoke(gomock.Any()).Return(res).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(res).AnyTimes()
 
        result := clusterInvoker.Invoke(context.TODO(), 
&invocation.RPCInvocation{})
 
diff --git a/cluster/cluster/broadcast/cluster_invoker_test.go 
b/cluster/cluster/broadcast/cluster_invoker_test.go
index bd09e9ee4..237743207 100644
--- a/cluster/cluster/broadcast/cluster_invoker_test.go
+++ b/cluster/cluster/broadcast/cluster_invoker_test.go
@@ -51,7 +51,7 @@ func registerBroadcast(mockInvokers ...*mock.MockInvoker) 
protocol.Invoker {
        invokers := []protocol.Invoker{}
        for _, ivk := range mockInvokers {
                invokers = append(invokers, ivk)
-               ivk.EXPECT().GetUrl().Return(broadcastUrl).AnyTimes()
+               ivk.EXPECT().GetURL().Return(broadcastUrl).AnyTimes()
        }
        staticDir := static.NewDirectory(invokers)
 
@@ -70,7 +70,7 @@ func TestBroadcastInvokeSuccess(t *testing.T) {
        for i := 0; i < 3; i++ {
                invoker := mock.NewMockInvoker(ctrl)
                invokers = append(invokers, invoker)
-               
invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+               invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        }
 
        clusterInvoker := registerBroadcast(invokers...)
@@ -90,17 +90,17 @@ func TestBroadcastInvokeFailed(t *testing.T) {
        for i := 0; i < 10; i++ {
                invoker := mock.NewMockInvoker(ctrl)
                invokers = append(invokers, invoker)
-               
invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+               invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        }
        {
                invoker := mock.NewMockInvoker(ctrl)
                invokers = append(invokers, invoker)
-               
invoker.EXPECT().Invoke(gomock.Any()).Return(mockFailedResult).AnyTimes()
+               invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockFailedResult).AnyTimes()
        }
        for i := 0; i < 10; i++ {
                invoker := mock.NewMockInvoker(ctrl)
                invokers = append(invokers, invoker)
-               
invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+               invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        }
 
        clusterInvoker := registerBroadcast(invokers...)
diff --git a/cluster/cluster/failback/cluster_test.go 
b/cluster/cluster/failback/cluster_test.go
index 4bf022f01..a7d2a5177 100644
--- a/cluster/cluster/failback/cluster_test.go
+++ b/cluster/cluster/failback/cluster_test.go
@@ -56,7 +56,7 @@ func registerFailback(invoker *mock.MockInvoker) 
protocol.Invoker {
        var invokers []protocol.Invoker
        invokers = append(invokers, invoker)
 
-       invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
 
        staticDir := static.NewDirectory(invokers)
        clusterInvoker := failbackCluster.Join(staticDir)
@@ -71,12 +71,12 @@ func TestFailbackSuceess(t *testing.T) {
        invoker := mock.NewMockInvoker(ctrl)
        clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
 
-       invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
 
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
        mockResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, 
Success: true}}
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
 
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
        assert.Equal(t, mockResult, result)
@@ -90,12 +90,12 @@ func TestFailbackRetryOneSuccess(t *testing.T) {
        invoker := mock.NewMockInvoker(ctrl)
        clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
 
-       invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
        invoker.EXPECT().IsAvailable().Return(true)
 
        // failed at first
        mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockFailedResult)
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockFailedResult)
 
        // success second
        var wg sync.WaitGroup
@@ -103,7 +103,7 @@ func TestFailbackRetryOneSuccess(t *testing.T) {
        now := time.Now()
        mockSuccResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, 
Success: true}}
        invoker.EXPECT().IsAvailable().Return(true)
-       
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func(protocol.Invocation) 
protocol.Result {
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(func(context.Context, protocol.Invocation) 
protocol.Result {
                delta := time.Since(now).Nanoseconds() / int64(time.Second)
                assert.True(t, delta >= 5)
                wg.Done()
@@ -135,11 +135,11 @@ func TestFailbackRetryFailed(t *testing.T) {
        invoker := mock.NewMockInvoker(ctrl)
        clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
 
-       invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
        mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockFailedResult)
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockFailedResult)
 
        //
        var wg sync.WaitGroup
@@ -150,7 +150,7 @@ func TestFailbackRetryFailed(t *testing.T) {
        // add retry call that eventually failed.
        for i := 0; i < retries; i++ {
                j := i + 1
-               
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func(protocol.Invocation) 
protocol.Result {
+               invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(func(context.Context, protocol.Invocation) 
protocol.Result {
                        delta := time.Since(now).Nanoseconds() / 
int64(time.Second)
                        assert.True(t, delta >= int64(5*j))
                        wg.Done()
@@ -184,17 +184,17 @@ func TestFailbackRetryFailed10Times(t *testing.T) {
        clusterInvoker.maxRetries = 10
 
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-       invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
 
        // 10 task should failed firstly.
        mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockFailedResult).Times(10)
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockFailedResult).Times(10)
 
        // 10 task should retry and failed.
        var wg sync.WaitGroup
        wg.Add(10)
        now := time.Now()
-       
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func(protocol.Invocation) 
protocol.Result {
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(func(context.Context, protocol.Invocation) 
protocol.Result {
                delta := time.Since(now).Nanoseconds() / int64(time.Second)
                assert.True(t, delta >= 5)
                wg.Done()
@@ -226,11 +226,11 @@ func TestFailbackOutOfLimit(t *testing.T) {
        clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
        clusterInvoker.failbackTasks = 1
 
-       invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
        mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockFailedResult).Times(11)
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockFailedResult).Times(11)
 
        // reached limit
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
diff --git a/cluster/cluster/failfast/cluster_test.go 
b/cluster/cluster/failfast/cluster_test.go
index ed34e684f..8637944ef 100644
--- a/cluster/cluster/failfast/cluster_test.go
+++ b/cluster/cluster/failfast/cluster_test.go
@@ -55,7 +55,7 @@ func registerFailfast(invoker *mock.MockInvoker) 
protocol.Invoker {
        invokers = append(invokers, invoker)
 
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-       invoker.EXPECT().GetUrl().Return(failfastUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failfastUrl).AnyTimes()
 
        staticDir := static.NewDirectory(invokers)
        clusterInvoker := failfastCluster.Join(staticDir)
@@ -70,11 +70,11 @@ func TestFailfastInvokeSuccess(t *testing.T) {
        clusterInvoker := registerFailfast(invoker)
 
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-       invoker.EXPECT().GetUrl().Return(failfastUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failfastUrl).AnyTimes()
 
        mockResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, 
Success: true}}
 
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
 
        assert.NoError(t, result.Error())
@@ -91,11 +91,11 @@ func TestFailfastInvokeFail(t *testing.T) {
        clusterInvoker := registerFailfast(invoker)
 
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-       invoker.EXPECT().GetUrl().Return(failfastUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failfastUrl).AnyTimes()
 
        mockResult := &protocol.RPCResult{Err: perrors.New("error")}
 
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
 
        assert.NotNil(t, result.Error())
diff --git a/cluster/cluster/failsafe/cluster_test.go 
b/cluster/cluster/failsafe/cluster_test.go
index 31796a47d..c8eeb0245 100644
--- a/cluster/cluster/failsafe/cluster_test.go
+++ b/cluster/cluster/failsafe/cluster_test.go
@@ -55,7 +55,7 @@ func registerFailsafe(invoker *mock.MockInvoker) 
protocol.Invoker {
        invokers = append(invokers, invoker)
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
-       invoker.EXPECT().GetUrl().Return(failsafeUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failsafeUrl).AnyTimes()
 
        staticDir := static.NewDirectory(invokers)
        clusterInvoker := failsafeCluster.Join(staticDir)
@@ -71,11 +71,11 @@ func TestFailSafeInvokeSuccess(t *testing.T) {
 
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
-       invoker.EXPECT().GetUrl().Return(failsafeUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failsafeUrl).AnyTimes()
 
        mockResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, 
Success: true}}
 
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
 
        assert.NoError(t, result.Error())
@@ -91,11 +91,11 @@ func TestFailSafeInvokeFail(t *testing.T) {
        clusterInvoker := registerFailsafe(invoker)
        invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
 
-       invoker.EXPECT().GetUrl().Return(failsafeUrl).AnyTimes()
+       invoker.EXPECT().GetURL().Return(failsafeUrl).AnyTimes()
 
        mockResult := &protocol.RPCResult{Err: perrors.New("error")}
 
-       invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult).AnyTimes()
+       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).Return(mockResult).AnyTimes()
        result := clusterInvoker.Invoke(context.Background(), 
&invocation.RPCInvocation{})
 
        assert.NoError(t, result.Error())
diff --git a/cluster/cluster/forking/cluster_test.go 
b/cluster/cluster/forking/cluster_test.go
index 427ba8718..42713cd96 100644
--- a/cluster/cluster/forking/cluster_test.go
+++ b/cluster/cluster/forking/cluster_test.go
@@ -53,7 +53,7 @@ func registerForking(mockInvokers ...*mock.MockInvoker) 
protocol.Invoker {
        var invokers []protocol.Invoker
        for _, ivk := range mockInvokers {
                invokers = append(invokers, ivk)
-               ivk.EXPECT().GetUrl().Return(forkingUrl).AnyTimes()
+               ivk.EXPECT().GetURL().Return(forkingUrl).AnyTimes()
        }
        staticDir := static.NewDirectory(invokers)
 
@@ -78,8 +78,8 @@ func TestForkingInvokeSuccess(t *testing.T) {
                invoker := mock.NewMockInvoker(ctrl)
                invokers = append(invokers, invoker)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-               invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                       func(protocol.Invocation) protocol.Result {
+               invoker.EXPECT().Invoke(gomock.Any(), gomock.Any()).DoAndReturn(
+                       func(context.Context, protocol.Invocation) 
protocol.Result {
                                wg.Done()
                                return mockResult
                        })
@@ -107,8 +107,8 @@ func TestForkingInvokeTimeout(t *testing.T) {
                invoker := mock.NewMockInvoker(ctrl)
                invokers = append(invokers, invoker)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-               invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                       func(protocol.Invocation) protocol.Result {
+               invoker.EXPECT().Invoke(gomock.Any(), gomock.Any()).DoAndReturn(
+                       func(context.Context, protocol.Invocation) 
protocol.Result {
                                time.Sleep(2 * time.Second)
                                wg.Done()
                                return mockResult
@@ -139,14 +139,14 @@ func TestForkingInvokeHalfTimeout(t *testing.T) {
                invokers = append(invokers, invoker)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
                if i == 1 {
-                       invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                               func(protocol.Invocation) protocol.Result {
+                       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(
+                               func(context.Context, protocol.Invocation) 
protocol.Result {
                                        wg.Done()
                                        return mockResult
                                }).AnyTimes()
                } else {
-                       invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                               func(protocol.Invocation) protocol.Result {
+                       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(
+                               func(context.Context, protocol.Invocation) 
protocol.Result {
                                        time.Sleep(2 * time.Second)
                                        wg.Done()
                                        return mockResult
diff --git a/cluster/cluster/zoneaware/cluster_invoker_test.go 
b/cluster/cluster/zoneaware/cluster_invoker_test.go
index db9ac4185..532a0c220 100644
--- a/cluster/cluster/zoneaware/cluster_invoker_test.go
+++ b/cluster/cluster/zoneaware/cluster_invoker_test.go
@@ -57,16 +57,16 @@ func TestZoneWareInvokerWithPreferredSuccess(t *testing.T) {
                url, _ := 
common.NewURL(fmt.Sprintf("dubbo://192.168.1.%v:20000/com.ikurento.user.UserProvider",
 i))
                invoker := mock.NewMockInvoker(ctrl)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-               invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+               invoker.EXPECT().GetURL().Return(url).AnyTimes()
                if 0 == i {
                        
url.SetParam(constant.RegistryKey+"."+constant.PreferredKey, "true")
-                       invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                               func(invocation protocol.Invocation) 
protocol.Result {
+                       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(
+                               func(ctx context.Context, invocation 
protocol.Invocation) protocol.Result {
                                        return mockResult
                                }).AnyTimes()
                } else {
-                       invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                               func(invocation protocol.Invocation) 
protocol.Result {
+                       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(
+                               func(ctx context.Context, invocation 
protocol.Invocation) protocol.Result {
                                        return &protocol.RPCResult{}
                                }).AnyTimes()
                }
@@ -99,12 +99,12 @@ func TestZoneWareInvokerWithWeightSuccess(t *testing.T) {
                url, _ := 
common.NewURL(fmt.Sprintf("dubbo://192.168.1.%v:20000/com.ikurento.user.UserProvider",
 i))
                invoker := mock.NewMockInvoker(ctrl)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-               invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+               invoker.EXPECT().GetURL().Return(url).AnyTimes()
                
url.SetParam(constant.RegistryKey+"."+constant.RegistryLabelKey, "true")
                if 1 == i {
                        
url.SetParam(constant.RegistryKey+"."+constant.WeightKey, w1)
-                       invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                               func(invocation protocol.Invocation) 
protocol.Result {
+                       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(
+                               func(ctx context.Context, invocation 
protocol.Invocation) protocol.Result {
                                        return &protocol.RPCResult{
                                                Attrs: 
map[string]interface{}{constant.WeightKey: w1},
                                                Rest:  clusterpkg.Rest{Tried: 
0, Success: true},
@@ -112,8 +112,8 @@ func TestZoneWareInvokerWithWeightSuccess(t *testing.T) {
                                }).MaxTimes(100)
                } else {
                        
url.SetParam(constant.RegistryKey+"."+constant.WeightKey, w2)
-                       invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                               func(invocation protocol.Invocation) 
protocol.Result {
+                       invoker.EXPECT().Invoke(gomock.Any(), 
gomock.Any()).DoAndReturn(
+                               func(ctx context.Context, invocation 
protocol.Invocation) protocol.Result {
                                        return &protocol.RPCResult{
                                                Attrs: 
map[string]interface{}{constant.WeightKey: w2},
                                                Rest:  clusterpkg.Rest{Tried: 
0, Success: true},
@@ -159,9 +159,9 @@ func TestZoneWareInvokerWithZoneSuccess(t *testing.T) {
 
                invoker := mock.NewMockInvoker(ctrl)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-               invoker.EXPECT().GetUrl().Return(url).AnyTimes()
-               invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-                       func(invocation protocol.Invocation) protocol.Result {
+               invoker.EXPECT().GetURL().Return(url).AnyTimes()
+               invoker.EXPECT().Invoke(gomock.Any(), gomock.Any()).DoAndReturn(
+                       func(ctx context.Context, invocation 
protocol.Invocation) protocol.Result {
                                return &protocol.RPCResult{
                                        Attrs: 
map[string]interface{}{constant.RegistryZoneKey: zoneValue},
                                        Rest:  clusterpkg.Rest{Tried: 0, 
Success: true},
@@ -196,7 +196,7 @@ func TestZoneWareInvokerWithZoneForceFail(t *testing.T) {
 
                invoker := mock.NewMockInvoker(ctrl)
                invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
-               invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+               invoker.EXPECT().GetURL().Return(url).AnyTimes()
                invokers = append(invokers, invoker)
        }
 
diff --git a/common/host_util.go b/common/host_util.go
index 355a9c5ed..ba36c0c8a 100644
--- a/common/host_util.go
+++ b/common/host_util.go
@@ -20,9 +20,13 @@ package common
 import (
        "os"
        "strconv"
+)
 
+import (
        gxnet "github.com/dubbogo/gost/net"
+)
 
+import (
        "dubbo.apache.org/dubbo-go/v3/common/constant"
 )
 
diff --git a/common/host_util_test.go b/common/host_util_test.go
index bb2f0d947..b78c4cf0f 100644
--- a/common/host_util_test.go
+++ b/common/host_util_test.go
@@ -20,14 +20,16 @@ package common
 import (
        "os"
        "testing"
-
-       "dubbo.apache.org/dubbo-go/v3/common/constant"
 )
 
 import (
        "github.com/stretchr/testify/assert"
 )
 
+import (
+       "dubbo.apache.org/dubbo-go/v3/common/constant"
+)
+
 func TestGetLocalIp(t *testing.T) {
        assert.NotNil(t, GetLocalIp())
 }
diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go
index 1a4ffa8bb..f2151855e 100644
--- a/config_center/nacos/impl.go
+++ b/config_center/nacos/impl.go
@@ -27,8 +27,8 @@ import (
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
        "github.com/dubbogo/gost/log/logger"
 
-       constant2 "github.com/nacos-group/nacos-sdk-go/common/constant"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       constant2 "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        perrors "github.com/pkg/errors"
 )
diff --git a/config_center/nacos/impl_test.go b/config_center/nacos/impl_test.go
index 8d7a08aaa..b2de57044 100644
--- a/config_center/nacos/impl_test.go
+++ b/config_center/nacos/impl_test.go
@@ -29,8 +29,8 @@ import (
 
        "github.com/golang/mock/gomock"
 
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 )
 
 import (
@@ -96,6 +96,11 @@ func (m *MockIConfigClient) DeleteConfig(param 
vo.ConfigParam) (bool, error) {
        return ret0, ret1
 }
 
+// CloseClient client nacos client
+func (mr *MockIConfigClient) CloseClient() {
+
+}
+
 // DeleteConfig indicates an expected call of DeleteConfig
 func (mr *MockIConfigClientMockRecorder) DeleteConfig(param interface{}) 
*gomock.Call {
        return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteConfig", 
reflect.TypeOf((*MockIConfigClient)(nil).DeleteConfig), param)
diff --git a/config_center/nacos/listener.go b/config_center/nacos/listener.go
index ab335db64..defcafe5b 100644
--- a/config_center/nacos/listener.go
+++ b/config_center/nacos/listener.go
@@ -24,8 +24,8 @@ import (
 import (
        "github.com/dubbogo/gost/log/logger"
 
-       constant2 "github.com/nacos-group/nacos-sdk-go/common/constant"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       constant2 "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 )
 
 import (
diff --git a/filter/active/filter_test.go b/filter/active/filter_test.go
index a4b0f5cdb..b347c08f5 100644
--- a/filter/active/filter_test.go
+++ b/filter/active/filter_test.go
@@ -44,8 +44,8 @@ func TestFilterInvoke(t *testing.T) {
        ctrl := gomock.NewController(t)
        defer ctrl.Finish()
        invoker := mock.NewMockInvoker(ctrl)
-       invoker.EXPECT().Invoke(gomock.Any()).Return(nil)
-       invoker.EXPECT().GetUrl().Return(url).Times(1)
+       invoker.EXPECT().Invoke(gomock.Any(), gomock.Any()).Return(nil)
+       invoker.EXPECT().GetURL().Return(url).Times(1)
        filter.Invoke(context.Background(), invoker, invoc)
        assert.True(t, 
invoc.GetAttachmentWithDefaultValue(dubboInvokeStartTime, "") != "")
 }
@@ -61,7 +61,7 @@ func TestFilterOnResponse(t *testing.T) {
        ctrl := gomock.NewController(t)
        defer ctrl.Finish()
        invoker := mock.NewMockInvoker(ctrl)
-       invoker.EXPECT().GetUrl().Return(url).Times(1)
+       invoker.EXPECT().GetURL().Return(url).Times(1)
        result := &protocol.RPCResult{
                Err: errors.New("test"),
        }
diff --git a/filter/auth/consumer_sign_filter_test.go 
b/filter/auth/consumer_sign_filter_test.go
index 05f5c1972..2a2004b43 100644
--- a/filter/auth/consumer_sign_filter_test.go
+++ b/filter/auth/consumer_sign_filter_test.go
@@ -46,8 +46,8 @@ func TestConsumerSignFilter_Invoke(t *testing.T) {
        defer ctrl.Finish()
        invoker := mock.NewMockInvoker(ctrl)
        result := &protocol.RPCResult{}
-       invoker.EXPECT().Invoke(inv).Return(result).Times(2)
-       invoker.EXPECT().GetUrl().Return(url).Times(2)
+       invoker.EXPECT().Invoke(context.Background(), 
inv).Return(result).Times(2)
+       invoker.EXPECT().GetURL().Return(url).Times(2)
        assert.Equal(t, result, filter.Invoke(context.Background(), invoker, 
inv))
 
        url.SetParam(constant.ServiceAuthKey, "true")
diff --git a/filter/auth/provider_auth_filter_test.go 
b/filter/auth/provider_auth_filter_test.go
index 1cdf15960..4489f0c97 100644
--- a/filter/auth/provider_auth_filter_test.go
+++ b/filter/auth/provider_auth_filter_test.go
@@ -66,8 +66,8 @@ func TestProviderAuthFilter_Invoke(t *testing.T) {
        defer ctrl.Finish()
        invoker := mock.NewMockInvoker(ctrl)
        result := &protocol.RPCResult{}
-       invoker.EXPECT().Invoke(inv).Return(result).Times(2)
-       invoker.EXPECT().GetUrl().Return(url).Times(2)
+       invoker.EXPECT().Invoke(context.Background(), 
inv).Return(result).Times(2)
+       invoker.EXPECT().GetURL().Return(url).Times(2)
        assert.Equal(t, result, filter.Invoke(context.Background(), invoker, 
inv))
        url.SetParam(constant.ServiceAuthKey, "true")
        assert.Equal(t, result, filter.Invoke(context.Background(), invoker, 
inv))
diff --git a/filter/generic/filter_test.go b/filter/generic/filter_test.go
index 4b99f952b..04a53c795 100644
--- a/filter/generic/filter_test.go
+++ b/filter/generic/filter_test.go
@@ -52,9 +52,9 @@ func TestFilter_Invoke(t *testing.T) {
        normalInvocation := invocation.NewRPCInvocation("Hello", 
[]interface{}{"arg1"}, make(map[string]interface{}))
 
        mockInvoker := mock.NewMockInvoker(ctrl)
-       mockInvoker.EXPECT().GetUrl().Return(invokeUrl).Times(2)
-       mockInvoker.EXPECT().Invoke(gomock.Not(normalInvocation)).DoAndReturn(
-               func(invocation protocol.Invocation) protocol.Result {
+       mockInvoker.EXPECT().GetURL().Return(invokeUrl).Times(2)
+       mockInvoker.EXPECT().Invoke(gomock.Any(), 
gomock.Not(normalInvocation)).DoAndReturn(
+               func(ctx context.Context, invocation protocol.Invocation) 
protocol.Result {
                        assert.Equal(t, constant.Generic, 
invocation.MethodName())
                        args := invocation.Arguments()
                        assert.Equal(t, "Hello", args[0])
@@ -85,9 +85,9 @@ func TestFilter_InvokeWithGenericCall(t *testing.T) {
        }, make(map[string]interface{}))
 
        mockInvoker := mock.NewMockInvoker(ctrl)
-       mockInvoker.EXPECT().GetUrl().Return(invokeUrl).Times(3)
-       mockInvoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
-               func(invocation protocol.Invocation) protocol.Result {
+       mockInvoker.EXPECT().GetURL().Return(invokeUrl).Times(3)
+       mockInvoker.EXPECT().Invoke(gomock.Any(), gomock.Any()).DoAndReturn(
+               func(arg0 context.Context, invocation protocol.Invocation) 
protocol.Result {
                        assert.Equal(t, constant.Generic, 
invocation.MethodName())
                        args := invocation.Arguments()
                        assert.Equal(t, "hello", args[0])
diff --git a/filter/generic/service_filter_test.go 
b/filter/generic/service_filter_test.go
index cf57a4fb5..aa77d6872 100644
--- a/filter/generic/service_filter_test.go
+++ b/filter/generic/service_filter_test.go
@@ -79,15 +79,15 @@ func TestServiceFilter_Invoke(t *testing.T) {
 
        // methodName is not "$invoke"
        invocation1 := invocation.NewRPCInvocation("test", nil, nil)
-       mockInvoker.EXPECT().Invoke(gomock.Eq(invocation1))
+       mockInvoker.EXPECT().Invoke(gomock.Any(), gomock.Eq(invocation1))
        _ = filter.Invoke(context.Background(), mockInvoker, invocation1)
        // arguments are nil
        invocation2 := invocation.NewRPCInvocation(constant.Generic, nil, nil)
-       mockInvoker.EXPECT().Invoke(gomock.Eq(invocation2))
+       mockInvoker.EXPECT().Invoke(gomock.Any(), gomock.Eq(invocation2))
        _ = filter.Invoke(context.Background(), mockInvoker, invocation2)
        // the number of arguments is not 3
        invocation3 := invocation.NewRPCInvocation(constant.Generic, 
[]interface{}{"hello"}, nil)
-       mockInvoker.EXPECT().Invoke(gomock.Eq(invocation3))
+       mockInvoker.EXPECT().Invoke(gomock.Any(), gomock.Eq(invocation3))
        _ = filter.Invoke(context.Background(), mockInvoker, invocation3)
 
        // hello service
@@ -107,7 +107,7 @@ func TestServiceFilter_Invoke(t *testing.T) {
        assert.Nil(t, err)
 
        // mock
-       mockInvoker.EXPECT().GetUrl().Return(ivkUrl).Times(3)
+       mockInvoker.EXPECT().GetURL().Return(ivkUrl).Times(3)
 
        // invoke a method without errors using default generalization
        invocation4 := invocation.NewRPCInvocation(constant.Generic,
@@ -146,12 +146,12 @@ func TestServiceFilter_Invoke(t *testing.T) {
        //              constant.GenericKey: 
constant.GenericSerializationProtobuf,
        //      })
 
-       mockInvoker.EXPECT().Invoke(gomock.All(
+       mockInvoker.EXPECT().Invoke(gomock.Any(), gomock.All(
                gomock.Not(invocation1),
                gomock.Not(invocation2),
                gomock.Not(invocation3),
        )).DoAndReturn(
-               func(invocation protocol.Invocation) protocol.Result {
+               func(ctx context.Context, invocation protocol.Invocation) 
protocol.Result {
                        switch invocation.MethodName() {
                        case "Hello":
                                who := invocation.Arguments()[0].(string)
diff --git a/go.mod b/go.mod
index a3493d35a..b80867bb2 100644
--- a/go.mod
+++ b/go.mod
@@ -35,7 +35,7 @@ require (
        github.com/magiconair/properties v1.8.6
        github.com/mitchellh/mapstructure v1.5.0
        github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
-       github.com/nacos-group/nacos-sdk-go v1.1.2
+       github.com/nacos-group/nacos-sdk-go/v2 v2.1.2
        github.com/natefinch/lumberjack v2.0.0+incompatible
        github.com/opentracing/opentracing-go v1.2.0
        github.com/pkg/errors v0.9.1
diff --git a/go.sum b/go.sum
index a697e61c9..39809e7b9 100644
--- a/go.sum
+++ b/go.sum
@@ -577,9 +577,8 @@ github.com/mschoch/smat v0.2.0 
h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
 github.com/mschoch/smat v0.2.0/go.mod 
h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod 
h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod 
h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/nacos-group/nacos-sdk-go v1.0.8 
h1:8pEm05Cdav9sQgJSv5kyvlgfz0SzFUUGI3pWX6SiSnM=
 github.com/nacos-group/nacos-sdk-go v1.0.8/go.mod 
h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA=
-github.com/nacos-group/nacos-sdk-go v1.1.2 
h1:lWTpf5SXLetQetS7p31eGic/ncqsnn0Zbau1i3eC25Y=
-github.com/nacos-group/nacos-sdk-go v1.1.2/go.mod 
h1:I8Vj4M8ZLpBk7EY2A8RXQE1SbfCA7b56TJBPIFTrUYE=
 github.com/nacos-group/nacos-sdk-go/v2 v2.1.2 
h1:A8GV6j0rw80I6tTKSav/pTpEgNECYXeFvZCsiLBWGnQ=
 github.com/nacos-group/nacos-sdk-go/v2 v2.1.2/go.mod 
h1:ys/1adWeKXXzbNWfRNbaFlX/t6HVLWdpsNDvmoWTw0g=
 github.com/natefinch/lumberjack v2.0.0+incompatible 
h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
@@ -710,9 +709,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod 
h1:1NzhyTcUVG4SuEtjjoZeV
 github.com/sirupsen/logrus v1.2.0/go.mod 
h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
 github.com/sirupsen/logrus v1.4.2/go.mod 
h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
 github.com/sirupsen/logrus v1.6.0/go.mod 
h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
+github.com/sirupsen/logrus v1.7.0 
h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
 github.com/sirupsen/logrus v1.7.0/go.mod 
h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
-github.com/sirupsen/logrus v1.8.1 
h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
-github.com/sirupsen/logrus v1.8.1/go.mod 
h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d 
h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod 
h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
 github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod 
h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
diff --git a/metadata/report/nacos/report.go b/metadata/report/nacos/report.go
index 655b57704..874967b2a 100644
--- a/metadata/report/nacos/report.go
+++ b/metadata/report/nacos/report.go
@@ -28,7 +28,7 @@ import (
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
        "github.com/dubbogo/gost/log/logger"
 
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        perrors "github.com/pkg/errors"
 )
diff --git a/metadata/report/nacos/report_test.go 
b/metadata/report/nacos/report_test.go
index 388bf81a5..759a45661 100644
--- a/metadata/report/nacos/report_test.go
+++ b/metadata/report/nacos/report_test.go
@@ -29,8 +29,8 @@ import (
 
        "github.com/golang/mock/gomock"
 
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 )
 
 import (
@@ -133,6 +133,10 @@ func (m *MockIConfigClient) ListenConfig(params 
vo.ConfigParam) error {
        return ret0
 }
 
+// CloseClient close nacos client
+func (m *MockIConfigClient) CloseClient() {
+}
+
 // ListenConfig indicates an expected call of ListenConfig
 func (mr *MockIConfigClientMockRecorder) ListenConfig(params interface{}) 
*gomock.Call {
        return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListenConfig", 
reflect.TypeOf((*MockIConfigClient)(nil).ListenConfig), params)
diff --git a/protocol/mock/mock_invoker.go b/protocol/mock/mock_invoker.go
index 99be5cfb6..c8a899a53 100644
--- a/protocol/mock/mock_invoker.go
+++ b/protocol/mock/mock_invoker.go
@@ -22,84 +22,92 @@
 package mock
 
 import (
-       "context"
-       "reflect"
+       context "context"
+       reflect "reflect"
 )
 
 import (
-       "github.com/golang/mock/gomock"
+       gomock "github.com/golang/mock/gomock"
 )
 
 import (
-       "dubbo.apache.org/dubbo-go/v3/common"
-       "dubbo.apache.org/dubbo-go/v3/protocol"
+       common "dubbo.apache.org/dubbo-go/v3/common"
+       protocol "dubbo.apache.org/dubbo-go/v3/protocol"
 )
 
-// MockInvoker is a mock of Invoker interface
+// MockInvoker is a mock of Invoker interface.
 type MockInvoker struct {
        ctrl     *gomock.Controller
        recorder *MockInvokerMockRecorder
 }
 
-// MockInvokerMockRecorder is the mock recorder for MockInvoker
+// MockInvokerMockRecorder is the mock recorder for MockInvoker.
 type MockInvokerMockRecorder struct {
        mock *MockInvoker
 }
 
-// NewMockInvoker creates a new mock instance
+// NewMockInvoker creates a new mock instance.
 func NewMockInvoker(ctrl *gomock.Controller) *MockInvoker {
        mock := &MockInvoker{ctrl: ctrl}
        mock.recorder = &MockInvokerMockRecorder{mock}
        return mock
 }
 
-// EXPECT returns an object that allows the caller to indicate expected use
+// EXPECT returns an object that allows the caller to indicate expected use.
 func (m *MockInvoker) EXPECT() *MockInvokerMockRecorder {
        return m.recorder
 }
 
-// GetURL mocks base method
+// Destroy mocks base method.
+func (m *MockInvoker) Destroy() {
+       m.ctrl.T.Helper()
+       m.ctrl.Call(m, "Destroy")
+}
+
+// Destroy indicates an expected call of Destroy.
+func (mr *MockInvokerMockRecorder) Destroy() *gomock.Call {
+       mr.mock.ctrl.T.Helper()
+       return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Destroy", 
reflect.TypeOf((*MockInvoker)(nil).Destroy))
+}
+
+// GetURL mocks base method.
 func (m *MockInvoker) GetURL() *common.URL {
+       m.ctrl.T.Helper()
        ret := m.ctrl.Call(m, "GetURL")
        ret0, _ := ret[0].(*common.URL)
        return ret0
 }
 
-// GetUrl indicates an expected call of GetUrl
-func (mr *MockInvokerMockRecorder) GetUrl() *gomock.Call {
+// GetURL indicates an expected call of GetURL.
+func (mr *MockInvokerMockRecorder) GetURL() *gomock.Call {
+       mr.mock.ctrl.T.Helper()
        return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetURL", 
reflect.TypeOf((*MockInvoker)(nil).GetURL))
 }
 
-// IsAvailable mocks base method
-func (m *MockInvoker) IsAvailable() bool {
-       ret := m.ctrl.Call(m, "IsAvailable")
-       ret0, _ := ret[0].(bool)
+// Invoke mocks base method.
+func (m *MockInvoker) Invoke(arg0 context.Context, arg1 protocol.Invocation) 
protocol.Result {
+       m.ctrl.T.Helper()
+       ret := m.ctrl.Call(m, "Invoke", arg0, arg1)
+       ret0, _ := ret[0].(protocol.Result)
        return ret0
 }
 
-// IsAvailable indicates an expected call of IsAvailable
-func (mr *MockInvokerMockRecorder) IsAvailable() *gomock.Call {
-       return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAvailable", 
reflect.TypeOf((*MockInvoker)(nil).IsAvailable))
-}
-
-// Destroy mocks base method
-func (m *MockInvoker) Destroy() {
-       m.ctrl.Call(m, "Destroy")
-}
-
-// Destroy indicates an expected call of Destroy
-func (mr *MockInvokerMockRecorder) Destroy() *gomock.Call {
-       return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Destroy", 
reflect.TypeOf((*MockInvoker)(nil).Destroy))
+// Invoke indicates an expected call of Invoke.
+func (mr *MockInvokerMockRecorder) Invoke(arg0, arg1 interface{}) *gomock.Call 
{
+       mr.mock.ctrl.T.Helper()
+       return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Invoke", 
reflect.TypeOf((*MockInvoker)(nil).Invoke), arg0, arg1)
 }
 
-// Invoke mocks base method
-func (m *MockInvoker) Invoke(ctx context.Context, arg0 protocol.Invocation) 
protocol.Result {
-       ret := m.ctrl.Call(m, "Invoke", arg0)
-       ret0, _ := ret[0].(protocol.Result)
+// IsAvailable mocks base method.
+func (m *MockInvoker) IsAvailable() bool {
+       m.ctrl.T.Helper()
+       ret := m.ctrl.Call(m, "IsAvailable")
+       ret0, _ := ret[0].(bool)
        return ret0
 }
 
-// Invoke indicates an expected call of Invoke
-func (mr *MockInvokerMockRecorder) Invoke(arg0 interface{}) *gomock.Call {
-       return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Invoke", 
reflect.TypeOf((*MockInvoker)(nil).Invoke), arg0)
+// IsAvailable indicates an expected call of IsAvailable.
+func (mr *MockInvokerMockRecorder) IsAvailable() *gomock.Call {
+       mr.mock.ctrl.T.Helper()
+       return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAvailable", 
reflect.TypeOf((*MockInvoker)(nil).IsAvailable))
 }
diff --git a/registry/nacos/listener.go b/registry/nacos/listener.go
index 230630e7d..a8e8f9655 100644
--- a/registry/nacos/listener.go
+++ b/registry/nacos/listener.go
@@ -30,8 +30,8 @@ import (
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
        "github.com/dubbogo/gost/log/logger"
 
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        perrors "github.com/pkg/errors"
 )
@@ -48,7 +48,7 @@ var (
        listenerCache sync.Map
 )
 
-type callback func(services []model.SubscribeService, err error)
+type callback func(services []model.Instance, err error)
 
 type nacosListener struct {
        namingClient   *nacosClient.NacosNamingClient
@@ -75,21 +75,6 @@ func NewNacosListener(url, regURL *common.URL, namingClient 
*nacosClient.NacosNa
        return listener, err
 }
 
-func generateInstance(ss model.SubscribeService) model.Instance {
-       return model.Instance{
-               InstanceId:  ss.InstanceId,
-               Ip:          ss.Ip,
-               Port:        ss.Port,
-               ServiceName: ss.ServiceName,
-               Valid:       ss.Valid,
-               Enable:      ss.Enable,
-               Weight:      ss.Weight,
-               Metadata:    ss.Metadata,
-               ClusterName: ss.ClusterName,
-               Healthy:     ss.Healthy,
-       }
-}
-
 func generateUrl(instance model.Instance) *common.URL {
        if instance.Metadata == nil {
                logger.Errorf("nacos instance metadata is empty,instance:%+v", 
instance)
@@ -123,7 +108,7 @@ func generateUrl(instance model.Instance) *common.URL {
 }
 
 // Callback will be invoked when got subscribed events.
-func (nl *nacosListener) Callback(services []model.SubscribeService, err 
error) {
+func (nl *nacosListener) Callback(services []model.Instance, err error) {
        if err != nil {
                logger.Errorf("nacos subscribe callback error:%s , 
subscribe:%+v ", err.Error(), nl.subscribeParam)
                return
@@ -142,7 +127,7 @@ func (nl *nacosListener) Callback(services 
[]model.SubscribeService, err error)
                        continue
                }
                host := services[i].Ip + ":" + 
strconv.Itoa(int(services[i].Port))
-               instance := generateInstance(services[i])
+               instance := services[i]
                newInstanceMap[host] = instance
                if old, ok := nl.instanceMap[host]; !ok && instance.Healthy {
                        // instance does not exist in cache, add it to cache
diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go
index 46da4bc66..5ee70107e 100644
--- a/registry/nacos/registry.go
+++ b/registry/nacos/registry.go
@@ -28,7 +28,7 @@ import (
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
        "github.com/dubbogo/gost/log/logger"
 
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        perrors "github.com/pkg/errors"
 )
diff --git a/registry/nacos/registry_test.go b/registry/nacos/registry_test.go
index 1012b8487..cde18ebf6 100644
--- a/registry/nacos/registry_test.go
+++ b/registry/nacos/registry_test.go
@@ -29,8 +29,8 @@ import (
 
        "github.com/golang/mock/gomock"
 
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 )
 
 import (
@@ -109,6 +109,10 @@ func (m *MockINamingClient) GetService(param 
vo.GetServiceParam) (model.Service,
        return ret0, ret1
 }
 
+// CloseClient close nacos client
+func (m *MockINamingClient) CloseClient() {
+}
+
 // GetService indicates an expected call of GetService
 func (mr *MockINamingClientMockRecorder) GetService(param interface{}) 
*gomock.Call {
        return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetService", 
reflect.TypeOf((*MockINamingClient)(nil).GetService), param)
diff --git a/registry/nacos/service_discovery.go 
b/registry/nacos/service_discovery.go
index 313bb014d..7f2f2cae3 100644
--- a/registry/nacos/service_discovery.go
+++ b/registry/nacos/service_discovery.go
@@ -28,8 +28,8 @@ import (
        gxpage "github.com/dubbogo/gost/hash/page"
        "github.com/dubbogo/gost/log/logger"
 
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        perrors "github.com/pkg/errors"
 )
@@ -246,7 +246,7 @@ func (n *nacosServiceDiscovery) AddListener(listener 
registry.ServiceInstancesCh
                err := n.namingClient.Client().Subscribe(&vo.SubscribeParam{
                        ServiceName: serviceName,
                        GroupName:   n.group,
-                       SubscribeCallback: func(services 
[]model.SubscribeService, err error) {
+                       SubscribeCallback: func(services []model.Instance, err 
error) {
                                if err != nil {
                                        logger.Errorf("Could not handle the 
subscribe notification because the err is not nil."+
                                                " service name: %s, err: %v", 
serviceName, err)
diff --git a/registry/nacos/service_discovery_test.go 
b/registry/nacos/service_discovery_test.go
index 07092b9d4..f48f84492 100644
--- a/registry/nacos/service_discovery_test.go
+++ b/registry/nacos/service_discovery_test.go
@@ -27,8 +27,8 @@ import (
 import (
        gxset "github.com/dubbogo/gost/container/set"
 
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        perrors "github.com/pkg/errors"
 
@@ -204,6 +204,9 @@ func (c mockClient) GetAllServicesInfo(param 
vo.GetAllServiceInfoParam) (model.S
        panic("implement me")
 }
 
+func (c mockClient) CloseClient() {
+}
+
 type mockProtocol struct{}
 
 func (m mockProtocol) Export(protocol.Invoker) protocol.Exporter {
diff --git a/registry/zookeeper/service_discovery_test.go 
b/registry/zookeeper/service_discovery_test.go
index 20e2e4659..00868b3c8 100644
--- a/registry/zookeeper/service_discovery_test.go
+++ b/registry/zookeeper/service_discovery_test.go
@@ -24,8 +24,8 @@ import (
 )
 
 import (
-       "github.com/nacos-group/nacos-sdk-go/model"
-       "github.com/nacos-group/nacos-sdk-go/vo"
+       "github.com/nacos-group/nacos-sdk-go/v2/model"
+       "github.com/nacos-group/nacos-sdk-go/v2/vo"
 
        "github.com/stretchr/testify/assert"
 )
diff --git a/remoting/nacos/builder.go b/remoting/nacos/builder.go
index bc8ebccbd..ff199227c 100644
--- a/remoting/nacos/builder.go
+++ b/remoting/nacos/builder.go
@@ -28,7 +28,7 @@ import (
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
        "github.com/dubbogo/gost/log/logger"
 
-       nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
+       nacosConstant "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
 
        perrors "github.com/pkg/errors"
 )
diff --git a/remoting/nacos/builder_test.go b/remoting/nacos/builder_test.go
index 751ac5a40..54e058fd9 100644
--- a/remoting/nacos/builder_test.go
+++ b/remoting/nacos/builder_test.go
@@ -29,7 +29,7 @@ import (
 
        nacosClient "github.com/dubbogo/gost/database/kv/nacos"
 
-       nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
+       nacosConstant "github.com/nacos-group/nacos-sdk-go/v2common/constant"
 
        "github.com/stretchr/testify/assert"
 )


Reply via email to