This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch feature-triple
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/feature-triple by this push:
new 924e15a14 Fix triple lint (#2456)
924e15a14 is described below
commit 924e15a1446e6b1a58bc974945e9259306bbe82b
Author: finalt <[email protected]>
AuthorDate: Fri Oct 27 17:54:51 2023 +0800
Fix triple lint (#2456)
---
config_center/dynamic_configuration_test.go | 7 +++++--
go.sum | 1 +
protocol/triple/server.go | 2 +-
protocol/triple/triple_protocol/handler_compat.go | 8 +++++++-
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/config_center/dynamic_configuration_test.go
b/config_center/dynamic_configuration_test.go
index 965e40bb3..fa400778e 100644
--- a/config_center/dynamic_configuration_test.go
+++ b/config_center/dynamic_configuration_test.go
@@ -28,13 +28,16 @@ import (
import (
"dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/global"
)
func TestWithTimeout(t *testing.T) {
fa := WithTimeout(12 * time.Second)
- opt := &Options{}
+ opt := &Options{
+ Center: &global.CenterConfig{},
+ }
fa(opt)
- assert.Equal(t, 12*time.Second, opt.Timeout)
+ assert.Equal(t, "12000", opt.Center.Timeout)
}
func TestGetRuleKey(t *testing.T) {
diff --git a/go.sum b/go.sum
index 824b45091..0bf5bb844 100644
--- a/go.sum
+++ b/go.sum
@@ -1004,6 +1004,7 @@ 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/v2 v2.1.2/go.mod
h1:ys/1adWeKXXzbNWfRNbaFlX/t6HVLWdpsNDvmoWTw0g=
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2
h1:FI+7vr1fvCA4jbgx36KezmP3zlU/WoP/7wAloaSd1Ew=
diff --git a/protocol/triple/server.go b/protocol/triple/server.go
index 64ece5796..79465df2d 100644
--- a/protocol/triple/server.go
+++ b/protocol/triple/server.go
@@ -125,7 +125,7 @@ func (s *Server) Start(invoker protocol.Invoker, info
*server.ServiceInfo) {
go func() {
mux := http.NewServeMux()
if info != nil {
- handleServiceWithInfo(invoker, info, mux)
+ handleServiceWithInfo(invoker, info, mux, hanOpts...)
} else {
compatHandleService(mux)
}
diff --git a/protocol/triple/triple_protocol/handler_compat.go
b/protocol/triple/triple_protocol/handler_compat.go
index e83cddb4d..ccd272d6a 100644
--- a/protocol/triple/triple_protocol/handler_compat.go
+++ b/protocol/triple/triple_protocol/handler_compat.go
@@ -31,8 +31,14 @@ import (
dubbo_protocol "dubbo.apache.org/dubbo-go/v3/protocol"
)
+type TripleCtxKey string
+
type MethodHandler func(srv interface{}, ctx context.Context, dec
func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{},
error)
+const (
+ TripleGoInterfaceNameKey TripleCtxKey = "XXX_TRIPLE_GO_INTERFACE_NAME"
+)
+
type tripleCompatInterceptor struct {
spec Spec
peer Peer
@@ -99,7 +105,7 @@ func NewCompatUnaryHandler(
}
return nil
}
- ctx = context.WithValue(ctx, "XXX_TRIPLE_GO_INTERFACE_NAME",
config.Procedure)
+ ctx = context.WithValue(ctx, TripleGoInterfaceNameKey,
config.Procedure)
respRaw, err := unary(srv, ctx, decodeFunc,
compatInterceptor.compatUnaryServerInterceptor)
if err != nil {
return err