From 7f87ea6f61a8c5da057cfbcf5966b77f7f423d44 Mon Sep 17 00:00:00 2001
From: lzp0412 <641785844@qq.com>
Date: Mon, 12 Aug 2019 11:02:01 +0800
Subject: [PATCH] coding standard

---
 registry/nacos/listener.go      | 24 ++++++++++++------------
 registry/nacos/registry_test.go |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/registry/nacos/listener.go b/registry/nacos/listener.go
index 4096856de..c42abd0bb 100644
--- a/registry/nacos/listener.go
+++ b/registry/nacos/listener.go
@@ -24,21 +24,21 @@ import (
 )
 
 type nacosListener struct {
-	namingClient    naming_client.INamingClient
-	listenUrl       common.URL
-	events          chan *remoting.ConfigChangeEvent
-	hostMapInstance map[string]model.Instance
-	cacheLock       sync.Mutex
-	done            chan struct{}
-	subscribeParam  *vo.SubscribeParam
+	namingClient   naming_client.INamingClient
+	listenUrl      common.URL
+	events         chan *remoting.ConfigChangeEvent
+	instanceMap    map[string]model.Instance
+	cacheLock      sync.Mutex
+	done           chan struct{}
+	subscribeParam *vo.SubscribeParam
 }
 
 func NewNacosListener(url common.URL, namingClient naming_client.INamingClient) (*nacosListener, error) {
 	listener := &nacosListener{
 		namingClient: namingClient,
 		listenUrl:    url, events: make(chan *remoting.ConfigChangeEvent, 32),
-		hostMapInstance: map[string]model.Instance{},
-		done:            make(chan struct{}),
+		instanceMap: map[string]model.Instance{},
+		done:        make(chan struct{}),
 	}
 	err := listener.startListen()
 	return listener, err
@@ -111,7 +111,7 @@ func (nl *nacosListener) Callback(services []model.SubscribeService, err error)
 		host := services[i].Ip + ":" + strconv.Itoa(int(services[i].Port))
 		instance := generateInstance(services[i])
 		newInstanceMap[host] = instance
-		if old, ok := nl.hostMapInstance[host]; !ok {
+		if old, ok := nl.instanceMap[host]; !ok {
 			//instance is not exsit in cache,add it to cache
 			addInstances = append(addInstances, instance)
 		} else {
@@ -122,14 +122,14 @@ func (nl *nacosListener) Callback(services []model.SubscribeService, err error)
 		}
 	}
 
-	for host, inst := range nl.hostMapInstance {
+	for host, inst := range nl.instanceMap {
 		if _, ok := newInstanceMap[host]; !ok {
 			//cache  instance is not exsit in  new instance list, remove it from  cache
 			delInstances = append(delInstances, inst)
 		}
 	}
 
-	nl.hostMapInstance = newInstanceMap
+	nl.instanceMap = newInstanceMap
 
 	for i := range addInstances {
 		newUrl := generateUrl(addInstances[i])
diff --git a/registry/nacos/registry_test.go b/registry/nacos/registry_test.go
index dfc4e6e51..97dea0d2b 100644
--- a/registry/nacos/registry_test.go
+++ b/registry/nacos/registry_test.go
@@ -139,7 +139,7 @@ func TestNacosRegistry_Subscribe_del(t *testing.T) {
 	assert.Regexp(t, ".*ServiceEvent{Action{add}.*", serviceEvent2.String())
 
 	nacosReg := reg.(*nacosRegistry)
-	//鎵嬪姩娉ㄩ攢瀹炰緥
+	//deregister  instance to mock instance offline
 	nacosReg.namingClient.DeregisterInstance(vo.DeregisterInstanceParam{Ip: "127.0.0.2", Port: 20000, ServiceName: "providers:com.ikurento.user.UserProvider:1.0.0:guangzhou-idc"})
 
 	serviceEvent3, _ := listener.Next()
-- 
GitLab