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

alexstocks 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 d2dccc4ec Fix: #2178 (#2204)
d2dccc4ec is described below

commit d2dccc4ece82d27adb17bc1e0f695eb9ad1ef488
Author: Xiaodong Dai <[email protected]>
AuthorDate: Wed Feb 8 16:36:57 2023 +0800

    Fix: #2178 (#2204)
---
 protocol/dubbo3/dubbo3_invoker.go | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/protocol/dubbo3/dubbo3_invoker.go 
b/protocol/dubbo3/dubbo3_invoker.go
index 23bc5c50f..9675cc978 100644
--- a/protocol/dubbo3/dubbo3_invoker.go
+++ b/protocol/dubbo3/dubbo3_invoker.go
@@ -47,7 +47,7 @@ import (
 // same as dubbo_invoker.go attachmentKey
 var attachmentKey = []string{
        constant.InterfaceKey, constant.GroupKey, constant.TokenKey, 
constant.TimeoutKey,
-       constant.VersionKey,
+       constant.VersionKey, tripleConstant.TripleServiceGroup, 
tripleConstant.TripleServiceVersion,
 }
 
 // DubboInvoker is implement of protocol.Invoker, a dubboInvoker refer to one 
service and ip.
@@ -182,7 +182,17 @@ func (di *DubboInvoker) Invoke(ctx context.Context, 
invocation protocol.Invocati
        }
 
        for _, k := range attachmentKey {
-               if v := di.GetURL().GetParam(k, ""); len(v) > 0 {
+               var paramKey string
+               switch k {
+               case tripleConstant.TripleServiceGroup:
+                       paramKey = constant.GroupKey
+               case tripleConstant.TripleServiceVersion:
+                       paramKey = constant.VersionKey
+               default:
+                       paramKey = k
+               }
+
+               if v := di.GetURL().GetParam(paramKey, ""); len(v) > 0 {
                        invocation.SetAttachment(k, v)
                }
        }

Reply via email to