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 62a5b61f7 Fix compilation (#2499)
62a5b61f7 is described below

commit 62a5b61f78270eb79564001f8967e79986010848
Author: Ken Liu <[email protected]>
AuthorDate: Sat Nov 11 16:02:42 2023 +0800

    Fix compilation (#2499)
---
 .github/workflows/github-actions.yml                       |  1 +
 Makefile                                                   |  2 +-
 client/options_test.go                                     | 10 ++++++++--
 common/url.go                                              | 14 +-------------
 config/protocol_config_test.go                             |  6 +++---
 config/root_config.go                                      |  5 +++--
 config_center/configurator/override.go                     |  3 +--
 config_center/parser/configuration_parser.go               |  6 +++---
 .../triple-tool/internal/proto/greet_old_triple.pb.go      | 12 +++++++-----
 .../triple-tool/internal/proto/greettriple/greet.triple.go |  3 ---
 10 files changed, 28 insertions(+), 34 deletions(-)

diff --git a/.github/workflows/github-actions.yml 
b/.github/workflows/github-actions.yml
index e15150cc8..2030a0ced 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -5,6 +5,7 @@ on:
     branches:
       - main
       - 'release-*'
+      - 'feature-*'
   pull_request:
     branches: "*"
 
diff --git a/Makefile b/Makefile
index f96c9be63..d47edf988 100644
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,7 @@ deps: prepare
 
 .PHONY: license
 license: clean prepareLic
-       $(GO_LICENSE_CHECKER) -v -a -r -i 
vendor,protocol/triple/triple_protocol $(LICENSE_DIR)/license.txt . go && [[ -z 
`git status -s` ]]
+       $(GO_LICENSE_CHECKER) -v -a -r -i 
vendor,protocol/triple/triple_protocol,protocol/triple/triple-tool/internal 
$(LICENSE_DIR)/license.txt . go && [[ -z `git status -s` ]]
 
 .PHONY: verify
 verify: clean license test
diff --git a/client/options_test.go b/client/options_test.go
index 6ca8c7610..5a8ff5f01 100644
--- a/client/options_test.go
+++ b/client/options_test.go
@@ -18,11 +18,17 @@
 package client
 
 import (
-       "dubbo.apache.org/dubbo-go/v3/common"
-       "github.com/stretchr/testify/assert"
        "testing"
 )
 
+import (
+       "github.com/stretchr/testify/assert"
+)
+
+import (
+       "dubbo.apache.org/dubbo-go/v3/common"
+)
+
 func TestWithURL(t *testing.T) {
        tests := []struct {
                opts    []ClientOption
diff --git a/common/url.go b/common/url.go
index 73e80e455..f00cf664e 100644
--- a/common/url.go
+++ b/common/url.go
@@ -119,19 +119,7 @@ type URL struct {
        // attributes should not be transported
        attributes map[string]interface{} `hessian:"-"`
        // special for registry
-       SubURL     *URL
-       attributes sync.Map
-}
-
-func (c *URL) AddAttribute(key string, value interface{}) {
-       if value != nil {
-               c.attributes.Store(key, value)
-       }
-}
-
-func (c *URL) GetAttribute(key string) interface{} {
-       v, _ := c.attributes.Load(key)
-       return v
+       SubURL *URL
 }
 
 // JavaClassName POJO for URL
diff --git a/config/protocol_config_test.go b/config/protocol_config_test.go
index 9068c91e7..d20c99d72 100644
--- a/config/protocol_config_test.go
+++ b/config/protocol_config_test.go
@@ -33,9 +33,9 @@ func TestGetProtocolsConfig(t *testing.T) {
                protocols := rootConfig.Protocols
                assert.NotNil(t, protocols)
                // default
-               assert.Equal(t, "dubbo", protocols["dubbo"].Name)
-               assert.Equal(t, string("20000"), protocols["dubbo"].Port)
-               assert.Equal(t, "4mib", protocols["dubbo"].MaxServerRecvMsgSize)
+               assert.Equal(t, "tri", protocols["tri"].Name)
+               assert.Equal(t, string("50051"), protocols["tri"].Port)
+               assert.Equal(t, "4mib", protocols["tri"].MaxServerRecvMsgSize)
        })
 
        t.Run("use config", func(t *testing.T) {
diff --git a/config/root_config.go b/config/root_config.go
index 07e4b8f5d..d904b7812 100644
--- a/config/root_config.go
+++ b/config/root_config.go
@@ -155,9 +155,10 @@ func (rc *RootConfig) Init() error {
        // init protocol
        protocols := rc.Protocols
        if len(protocols) <= 0 {
-               protocol := &ProtocolConfig{}
+               protocol := ProtocolConfig{}
                protocols = make(map[string]*ProtocolConfig, 1)
-               protocols[constant.Dubbo] = protocol
+               // todo, default value should be determined in a unified way
+               protocols["tri"] = &protocol
                rc.Protocols = protocols
        }
        for _, protocol := range protocols {
diff --git a/config_center/configurator/override.go 
b/config_center/configurator/override.go
index fb1f0d616..a0edef60c 100644
--- a/config_center/configurator/override.go
+++ b/config_center/configurator/override.go
@@ -81,8 +81,7 @@ func (c *overrideConfigurator) Configure(url *common.URL) {
 // configureIfMatch
 func (c *overrideConfigurator) configureIfMatchV3(host string, url 
*common.URL) {
        conditionKeys := getConditionKeys()
-       matcher := c.configuratorUrl.GetAttribute(constant.MatchCondition)
-       if matcher != nil {
+       if matcher, ok := 
c.configuratorUrl.GetAttribute(constant.MatchCondition); ok {
                conditionMatcher := matcher.(*parser.ConditionMatch)
                if conditionMatcher.IsMatch(host, url) {
                        configUrl := 
c.configuratorUrl.CloneExceptParams(conditionKeys)
diff --git a/config_center/parser/configuration_parser.go 
b/config_center/parser/configuration_parser.go
index a262cc605..81c98b73d 100644
--- a/config_center/parser/configuration_parser.go
+++ b/config_center/parser/configuration_parser.go
@@ -177,7 +177,7 @@ func serviceItemToUrls(item ConfigItem, config 
ConfiguratorConfig) ([]*common.UR
                                if err != nil {
                                        return nil, perrors.WithStack(err)
                                }
-                               url.AddAttribute(constant.MatchCondition, 
item.Match)
+                               url.SetAttribute(constant.MatchCondition, 
item.Match)
                                urls = append(urls, url)
                        }
                } else {
@@ -185,7 +185,7 @@ func serviceItemToUrls(item ConfigItem, config 
ConfiguratorConfig) ([]*common.UR
                        if err != nil {
                                return nil, perrors.WithStack(err)
                        }
-                       url.AddAttribute(constant.MatchCondition, item.Match)
+                       url.SetAttribute(constant.MatchCondition, item.Match)
                        urls = append(urls, url)
                }
        }
@@ -227,7 +227,7 @@ func appItemToUrls(item ConfigItem, config 
ConfiguratorConfig) ([]*common.URL, e
                        if err != nil {
                                return nil, perrors.WithStack(err)
                        }
-                       url.AddAttribute(constant.MatchCondition, item.Match)
+                       url.SetAttribute(constant.MatchCondition, item.Match)
                        urls = append(urls, url)
                }
        }
diff --git a/protocol/triple/triple-tool/internal/proto/greet_old_triple.pb.go 
b/protocol/triple/triple-tool/internal/proto/greet_old_triple.pb.go
index cecab60c4..e19963d71 100644
--- a/protocol/triple/triple-tool/internal/proto/greet_old_triple.pb.go
+++ b/protocol/triple/triple-tool/internal/proto/greet_old_triple.pb.go
@@ -29,11 +29,6 @@ import (
 )
 
 import (
-       constant1 "dubbo.apache.org/dubbo-go/v3/common/constant"
-       protocol "dubbo.apache.org/dubbo-go/v3/protocol"
-       dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
-       invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
-
        grpc_go "github.com/dubbogo/grpc-go"
        codes "github.com/dubbogo/grpc-go/codes"
        metadata "github.com/dubbogo/grpc-go/metadata"
@@ -44,6 +39,13 @@ import (
        triple "github.com/dubbogo/triple/pkg/triple"
 )
 
+import (
+       constant1 "dubbo.apache.org/dubbo-go/v3/common/constant"
+       protocol "dubbo.apache.org/dubbo-go/v3/protocol"
+       dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
+       invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
+)
+
 // This is a compile-time assertion to ensure that this generated file
 // is compatible with the grpc package it is being compiled against.
 const _ = grpc_go.SupportPackageIsVersion7
diff --git 
a/protocol/triple/triple-tool/internal/proto/greettriple/greet.triple.go 
b/protocol/triple/triple-tool/internal/proto/greettriple/greet.triple.go
index 7c16eafff..b284e07f3 100644
--- a/protocol/triple/triple-tool/internal/proto/greettriple/greet.triple.go
+++ b/protocol/triple/triple-tool/internal/proto/greettriple/greet.triple.go
@@ -30,9 +30,6 @@ import (
        "dubbo.apache.org/dubbo-go/v3/common/constant"
        "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
        "dubbo.apache.org/dubbo-go/v3/server"
-)
-
-import (
        proto "dubbo.apache.org/dubbo-go/v3/triple-tool/internal/proto"
 )
 

Reply via email to