You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/01/04 07:19:29 UTC

[dubbo-go] 01/01: fix ctx linter error

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

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

commit 644fac306c1d4081381b2f02ddf21a18e953bfb9
Author: AlexStocks <al...@foxmail.com>
AuthorDate: Mon Jan 4 15:06:32 2021 +0800

    fix ctx linter error
---
 common/constant/key.go                                    | 2 +-
 config_center/apollo/listener.go                          | 2 +-
 filter/filter_impl/tps/tps_limiter_method_service_test.go | 2 +-
 remoting/getty/listener_test.go                           | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/constant/key.go b/common/constant/key.go
index 12e3096..50aea81 100644
--- a/common/constant/key.go
+++ b/common/constant/key.go
@@ -200,7 +200,7 @@ const (
 )
 
 const (
-	TRACING_REMOTE_SPAN_CTX = "tracing.remote.span.ctx"
+	TRACING_REMOTE_SPAN_CTX = DubboCtxKey("tracing.remote.span.ctx")
 )
 
 // Use for router module
diff --git a/config_center/apollo/listener.go b/config_center/apollo/listener.go
index ace5ed0..44d3255 100644
--- a/config_center/apollo/listener.go
+++ b/config_center/apollo/listener.go
@@ -36,7 +36,7 @@ type apolloListener struct {
 // nolint
 func newApolloListener() *apolloListener {
 	return &apolloListener{
-		listeners: make(map[config_center.ConfigurationListener]struct{}, 0),
+		listeners: make(map[config_center.ConfigurationListener]struct{}),
 	}
 }
 
diff --git a/filter/filter_impl/tps/tps_limiter_method_service_test.go b/filter/filter_impl/tps/tps_limiter_method_service_test.go
index a70287e..4ff0a23 100644
--- a/filter/filter_impl/tps/tps_limiter_method_service_test.go
+++ b/filter/filter_impl/tps/tps_limiter_method_service_test.go
@@ -113,7 +113,7 @@ func TestMethodServiceTpsLimiterImplIsAllowableMethodLevelOverride(t *testing.T)
 func TestMethodServiceTpsLimiterImplIsAllowableBothMethodAndService(t *testing.T) {
 	methodName := "hello3"
 	methodConfigPrefix := "methods." + methodName + "."
-	invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]interface{}, 0))
+	invoc := invocation.NewRPCInvocation(methodName, []interface{}{"OK"}, make(map[string]interface{}))
 	ctrl := gomock.NewController(t)
 	defer ctrl.Finish()
 
diff --git a/remoting/getty/listener_test.go b/remoting/getty/listener_test.go
index 956ecf9..2700ed8 100644
--- a/remoting/getty/listener_test.go
+++ b/remoting/getty/listener_test.go
@@ -23,14 +23,14 @@ import (
 )
 
 import (
+	"github.com/opentracing/opentracing-go"
+	"github.com/opentracing/opentracing-go/mocktracer"
 	"github.com/stretchr/testify/assert"
 )
 
 import (
 	"github.com/apache/dubbo-go/common/constant"
 	"github.com/apache/dubbo-go/protocol/invocation"
-	"github.com/opentracing/opentracing-go"
-	"github.com/opentracing/opentracing-go/mocktracer"
 )
 
 // test rebuild the ctx
@@ -63,7 +63,7 @@ func TestRebuildCtx(t *testing.T) {
 // Once we decided to transfer more context's key-value, we should change this.
 // now we only support rebuild the tracing context
 func rebuildCtx(inv *invocation.RPCInvocation) context.Context {
-	ctx := context.WithValue(context.Background(), "attachment", inv.Attachments())
+	ctx := context.WithValue(context.Background(), constant.DubboCtxKey("attachment"), inv.Attachments())
 
 	// actually, if user do not use any opentracing framework, the err will not be nil.
 	spanCtx, err := opentracing.GlobalTracer().Extract(opentracing.TextMap,