From 3635fea2537a2c8cd87be3b34381330c3ab53a40 Mon Sep 17 00:00:00 2001 From: "vito.he" <hxmhlt@163.com> Date: Wed, 29 May 2019 20:24:33 +0800 Subject: [PATCH] Mod:format import & fix smell code --- common/url_test.go | 2 +- common/utils/strings_test.go | 4 +++- config/reference_config.go | 2 +- config/testdata/consumer_config.yml | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/url_test.go b/common/url_test.go index ff5463275..21c1aeeb1 100644 --- a/common/url_test.go +++ b/common/url_test.go @@ -16,12 +16,12 @@ package common import ( "context" - "github.com/dubbo/go-for-apache-dubbo/common/constant" "net/url" "testing" ) import ( + "github.com/dubbo/go-for-apache-dubbo/common/constant" "github.com/stretchr/testify/assert" ) diff --git a/common/utils/strings_test.go b/common/utils/strings_test.go index 37db57004..73080ab9e 100644 --- a/common/utils/strings_test.go +++ b/common/utils/strings_test.go @@ -1,9 +1,11 @@ package utils import ( - "github.com/stretchr/testify/assert" "testing" ) +import ( + "github.com/stretchr/testify/assert" +) func Test_RegSplit(t *testing.T) { strings := RegSplit("dubbo://123.1.2.1;jsonrpc://127.0.0.1;registry://3.2.1.3?registry=zookeeper", "\\s*[;]+\\s*") diff --git a/config/reference_config.go b/config/reference_config.go index 2124cd44e..fb83b8001 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -109,7 +109,7 @@ func (refconfig *ReferenceConfig) Refer() { refconfig.invoker = extension.GetProtocol(refconfig.urls[0].Protocol).Refer(*refconfig.urls[0]) } else { invokers := []protocol.Invoker{} - var regUrl *common.URL = nil + var regUrl *common.URL for _, u := range refconfig.urls { invokers = append(invokers, extension.GetProtocol(u.Protocol).Refer(*u)) if u.Protocol == constant.REGISTRY_PROTOCOL { diff --git a/config/testdata/consumer_config.yml b/config/testdata/consumer_config.yml index 8a9aeafac..db242c95a 100644 --- a/config/testdata/consumer_config.yml +++ b/config/testdata/consumer_config.yml @@ -38,6 +38,7 @@ references: filter: "" protocol : "dubbo" interface : "com.ikurento.user.UserProvider" + url: "dubbo://127.0.0.1:20000" cluster: "failover" methods : - name: "GetUser" -- GitLab