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:06:50 UTC

[dubbo-go] branch develop updated: 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


The following commit(s) were added to refs/heads/develop by this push:
     new f5de913  fix ctx linter error
f5de913 is described below

commit f5de9131dd62f6a1da60e7aff351f11017ac8b3a
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 +-
 protocol/rest/server/rest_server.go                       | 2 +-
 remoting/getty/listener_test.go                           | 6 +++---
 5 files changed, 7 insertions(+), 7 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/protocol/rest/server/rest_server.go b/protocol/rest/server/rest_server.go
index b0bf0e0..caa19e9 100644
--- a/protocol/rest/server/rest_server.go
+++ b/protocol/rest/server/rest_server.go
@@ -225,7 +225,7 @@ func assembleArgsFromBody(methodConfig *rest_config.RestMethodConfig, argsTypes
 		}
 		var ni interface{}
 		if t.String() == "[]interface {}" {
-			ni = make([]map[string]interface{}, 0)
+			ni = make([]map[string]interface{})
 		} else if t.String() == "interface {}" {
 			ni = make(map[string]interface{})
 		} else {
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,