From f0c9c8f990489cd975428520cf550ffc331c439f Mon Sep 17 00:00:00 2001
From: Joe Zou <yixian.zou@gmail.com>
Date: Tue, 19 May 2020 08:39:13 +0800
Subject: [PATCH] fix review  problems

---
 registry/base_registry.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/registry/base_registry.go b/registry/base_registry.go
index 39186eef0..b3044294d 100644
--- a/registry/base_registry.go
+++ b/registry/base_registry.go
@@ -56,6 +56,8 @@ func init() {
 	localIP, _ = gxnet.GetLocalIP()
 }
 
+type createPathFunc func(dubboPath string) error
+
 /*
  * -----------------------------------NOTICE---------------------------------------------
  * If there is no special case, you'd better inherit BaseRegistry and implement the
@@ -332,7 +334,7 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, createP
 }
 
 // consumerRegistry for consumer role do
-func (r *BaseRegistry) consumerRegistry(c common.URL, params url.Values, createPathFunc func(dubboPath string) error) (string, string, error) {
+func (r *BaseRegistry) consumerRegistry(c common.URL, params url.Values, f createPathFunc) (string, string, error) {
 	var (
 		dubboPath string
 		rawURL    string
@@ -340,8 +342,8 @@ func (r *BaseRegistry) consumerRegistry(c common.URL, params url.Values, createP
 	)
 	dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), common.DubboNodes[common.CONSUMER])
 
-	if createPathFunc != nil {
-		err = createPathFunc(dubboPath)
+	if f != nil {
+		err = f(dubboPath)
 	}
 	if err != nil {
 		logger.Errorf("facadeBasedRegistry.CreatePath(path{%s}) = error{%v}", dubboPath, perrors.WithStack(err))
@@ -349,8 +351,8 @@ func (r *BaseRegistry) consumerRegistry(c common.URL, params url.Values, createP
 	}
 	dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), common.DubboNodes[common.PROVIDER])
 
-	if createPathFunc != nil {
-		err = createPathFunc(dubboPath)
+	if f != nil {
+		err = f(dubboPath)
 	}
 
 	if err != nil {
-- 
GitLab