You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/01/03 14:03:40 UTC
[dubbo-go] 01/01: delete unused var
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
commit 78ca7f6a4f88a0f8b6a0aeaaf5930275b926d291
Author: AlexStocks <al...@foxmail.com>
AuthorDate: Sun Jan 3 21:31:35 2021 +0800
delete unused var
---
cluster/cluster_impl/failback_cluster_invoker.go | 3 +--
cluster/router/chain/chain.go | 2 +-
cluster/router/chain/chain_test.go | 2 ++
cluster/router/condition/listenable_router.go | 4 ++--
cluster/router/tag/file.go | 2 +-
cluster/router/tag/tag_router.go | 4 ++--
cluster/router/tag/tag_router_test.go | 2 +-
common/config/environment.go | 4 ++--
config/base_config.go | 2 +-
config/base_config_test.go | 1 +
config/config_center_config.go | 6 ++----
config_center/nacos/client.go | 2 +-
config_center/zookeeper/impl.go | 2 +-
filter/filter_impl/auth/sign_util.go | 2 +-
metadata/mapping/dynamic/service_name_mapping_test.go | 1 +
metadata/report/delegate/delegate_report_test.go | 6 ++----
metadata/service/inmemory/service_proxy.go | 10 +++-------
protocol/dubbo/dubbo_invoker_test.go | 2 +-
protocol/jsonrpc/http.go | 16 ++++++++--------
protocol/jsonrpc/http_test.go | 2 +-
protocol/protocolwrapper/mock_protocol_filter.go | 1 -
registry/base_registry.go | 3 +--
registry/consul/service_discovery.go | 2 +-
registry/consul/service_discovery_test.go | 3 ++-
registry/directory/directory.go | 7 +++----
registry/mock_registry.go | 5 +----
registry/nacos/service_discovery_test.go | 3 ++-
registry/zookeeper/registry.go | 2 +-
registry/zookeeper/registry_test.go | 3 ++-
registry/zookeeper/service_discovery.go | 6 +++---
registry/zookeeper/service_discovery_test.go | 11 ++++++++---
remoting/etcdv3/client_test.go | 2 --
remoting/getty/getty_client_test.go | 3 ++-
remoting/getty/pool.go | 6 ++----
remoting/kubernetes/facade_test.go | 7 +++----
35 files changed, 66 insertions(+), 73 deletions(-)
diff --git a/cluster/cluster_impl/failback_cluster_invoker.go b/cluster/cluster_impl/failback_cluster_invoker.go
index 7654e42..5e0d133 100644
--- a/cluster/cluster_impl/failback_cluster_invoker.go
+++ b/cluster/cluster_impl/failback_cluster_invoker.go
@@ -77,8 +77,7 @@ func (invoker *failbackClusterInvoker) tryTimerTaskProc(ctx context.Context, ret
invoked = append(invoked, retryTask.lastInvoker)
retryInvoker := invoker.doSelect(retryTask.loadbalance, retryTask.invocation, retryTask.invokers, invoked)
- var result protocol.Result
- result = retryInvoker.Invoke(ctx, retryTask.invocation)
+ result := retryInvoker.Invoke(ctx, retryTask.invocation)
if result.Error() != nil {
retryTask.lastInvoker = retryInvoker
invoker.checkRetry(retryTask, result.Error())
diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go
index 8b98acb..fccce83 100644
--- a/cluster/router/chain/chain.go
+++ b/cluster/router/chain/chain.go
@@ -195,7 +195,7 @@ func (c *RouterChain) copyInvokerIfNecessary(cache *InvokerCache) []protocol.Inv
func (c *RouterChain) buildCache() {
origin := c.loadCache()
invokers := c.copyInvokerIfNecessary(origin)
- if invokers == nil || len(invokers) == 0 {
+ if len(invokers) == 0 {
return
}
diff --git a/cluster/router/chain/chain_test.go b/cluster/router/chain/chain_test.go
index 92c59d7..a2b5642 100644
--- a/cluster/router/chain/chain_test.go
+++ b/cluster/router/chain/chain_test.go
@@ -238,6 +238,7 @@ conditions:
func TestRouterChainRouteNoRoute(t *testing.T) {
ts, z, _, err := zookeeper.NewMockZookeeperClient("test", 15*time.Second)
+ assert.Nil(t, err)
defer func() {
err := ts.Stop()
assert.NoError(t, err)
@@ -247,6 +248,7 @@ func TestRouterChainRouteNoRoute(t *testing.T) {
zkUrl, _ := common.NewURL(fmt.Sprintf(zkFormat, localIP, ts.Servers[0].Port))
configuration, err := extension.GetConfigCenterFactory(zk).GetDynamicConfiguration(zkUrl)
config.GetEnvInstance().SetDynamicConfiguration(configuration)
+ assert.Nil(t, err)
chain, err := NewRouterChain(getConditionNoRouteUrl(applicationKey))
assert.Nil(t, err)
diff --git a/cluster/router/condition/listenable_router.go b/cluster/router/condition/listenable_router.go
index 0b47310..102d766 100644
--- a/cluster/router/condition/listenable_router.go
+++ b/cluster/router/condition/listenable_router.go
@@ -47,8 +47,8 @@ type listenableRouter struct {
conditionRouters []*ConditionRouter
routerRule *RouterRule
url *common.URL
- force bool
- priority int64
+ //force bool
+ priority int64
}
// RouterRule Get RouterRule instance from listenableRouter
diff --git a/cluster/router/tag/file.go b/cluster/router/tag/file.go
index 94daf15..a51ae69 100644
--- a/cluster/router/tag/file.go
+++ b/cluster/router/tag/file.go
@@ -41,7 +41,7 @@ type FileTagRouter struct {
router *tagRouter
routerRule *RouterRule
url *common.URL
- force bool
+ //force bool
}
// NewFileTagRouter Create file tag router instance with content (from config file)
diff --git a/cluster/router/tag/tag_router.go b/cluster/router/tag/tag_router.go
index c7f5304..984ecb4 100644
--- a/cluster/router/tag/tag_router.go
+++ b/cluster/router/tag/tag_router.go
@@ -53,7 +53,7 @@ type addrMetadata struct {
// application name
application string
// is rule a runtime rule
- ruleRuntime bool
+ //ruleRuntime bool
// is rule a force rule
ruleForce bool
// is rule a valid rule
@@ -227,7 +227,7 @@ func (c *tagRouter) Pool(invokers []protocol.Invoker) (router.AddrPool, router.A
// fetchRuleIfNecessary fetches, parses rule and register listener for the further change
func (c *tagRouter) fetchRuleIfNecessary(invokers []protocol.Invoker) {
- if invokers == nil || len(invokers) == 0 {
+ if len(invokers) == 0 {
return
}
diff --git a/cluster/router/tag/tag_router_test.go b/cluster/router/tag/tag_router_test.go
index 20b511d..26c4b83 100644
--- a/cluster/router/tag/tag_router_test.go
+++ b/cluster/router/tag/tag_router_test.go
@@ -237,7 +237,7 @@ func TestRouteBeijingInvoker(t *testing.T) {
type DynamicTagRouter struct {
suite.Suite
- rule *RouterRule
+ //rule *RouterRule
route *tagRouter
zkClient *zookeeper.ZookeeperClient
diff --git a/common/config/environment.go b/common/config/environment.go
index 44cdd1f..c5651a3 100644
--- a/common/config/environment.go
+++ b/common/config/environment.go
@@ -34,8 +34,8 @@ import (
// We just have config center configuration which can override configuration in consumer.yaml & provider.yaml.
// But for add these features in future ,I finish the environment struct following Environment class in java.
type Environment struct {
- configCenterFirst bool
- externalConfigs sync.Map
+ configCenterFirst bool
+ //externalConfigs sync.Map
externalConfigMap sync.Map
appExternalConfigMap sync.Map
dynamicConfiguration config_center.DynamicConfiguration
diff --git a/config/base_config.go b/config/base_config.go
index 0cc6eec..7cb25a5 100644
--- a/config/base_config.go
+++ b/config/base_config.go
@@ -45,7 +45,7 @@ type BaseConfig struct {
// application config
ApplicationConfig *ApplicationConfig `yaml:"application" json:"application,omitempty" property:"application"`
- prefix string
+ //prefix string
fatherConfig interface{}
EventDispatcherType string `default:"direct" yaml:"event_dispatcher_type" json:"event_dispatcher_type,omitempty"`
MetricConfig *MetricConfig `yaml:"metrics" json:"metrics,omitempty"`
diff --git a/config/base_config_test.go b/config/base_config_test.go
index 9e5565f..566b49b 100644
--- a/config/base_config_test.go
+++ b/config/base_config_test.go
@@ -107,6 +107,7 @@ var baseMockRef = map[string]*ReferenceConfig{
func TestRefresh(t *testing.T) {
c := &BaseConfig{}
+ c.fileStream = nil
mockMap := getMockMap()
mockMap["dubbo.shutdown.timeout"] = "12s"
diff --git a/config/config_center_config.go b/config/config_center_config.go
index 3bb8564..940b7be 100644
--- a/config/config_center_config.go
+++ b/config/config_center_config.go
@@ -18,10 +18,8 @@
package config
import (
- "context"
"net/url"
"reflect"
- "time"
)
import (
@@ -46,7 +44,7 @@ import (
//
// ConfigCenter has currently supported Zookeeper, Nacos, Etcd, Consul, Apollo
type ConfigCenterConfig struct {
- context context.Context
+ //context context.Context
Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty"`
Address string `yaml:"address" json:"address,omitempty"`
Cluster string `yaml:"cluster" json:"cluster,omitempty"`
@@ -60,7 +58,7 @@ type ConfigCenterConfig struct {
AppId string `default:"dubbo" yaml:"app_id" json:"app_id,omitempty"`
TimeoutStr string `yaml:"timeout" json:"timeout,omitempty"`
RemoteRef string `required:"false" yaml:"remote_ref" json:"remote_ref,omitempty"`
- timeout time.Duration
+ //timeout time.Duration
}
// UnmarshalYAML unmarshals the ConfigCenterConfig by @unmarshal function
diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go
index c7d631c..1e96b36 100644
--- a/config_center/nacos/client.go
+++ b/config_center/nacos/client.go
@@ -65,7 +65,7 @@ type option func(*options)
type options struct {
nacosName string
- client *NacosClient
+ //client *NacosClient
}
// WithNacosName Set nacos name
diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go
index 17812e9..f3b2235 100644
--- a/config_center/zookeeper/impl.go
+++ b/config_center/zookeeper/impl.go
@@ -52,7 +52,7 @@ type zookeeperDynamicConfiguration struct {
done chan struct{}
client *zookeeper.ZookeeperClient
- listenerLock sync.Mutex
+ //listenerLock sync.Mutex
listener *zookeeper.ZkEventListener
cacheListener *CacheListener
parser parser.ConfigurationParser
diff --git a/filter/filter_impl/auth/sign_util.go b/filter/filter_impl/auth/sign_util.go
index cb18537..4c12c76 100644
--- a/filter/filter_impl/auth/sign_util.go
+++ b/filter/filter_impl/auth/sign_util.go
@@ -37,7 +37,7 @@ func Sign(metadata, key string) string {
// SignWithParams returns a signature with giving params and metadata.
func SignWithParams(params []interface{}, metadata, key string) (string, error) {
- if params == nil || len(params) == 0 {
+ if len(params) == 0 {
return Sign(metadata, key), nil
}
diff --git a/metadata/mapping/dynamic/service_name_mapping_test.go b/metadata/mapping/dynamic/service_name_mapping_test.go
index 2896b0f..af21704 100644
--- a/metadata/mapping/dynamic/service_name_mapping_test.go
+++ b/metadata/mapping/dynamic/service_name_mapping_test.go
@@ -39,6 +39,7 @@ func TestDynamicConfigurationServiceNameMapping(t *testing.T) {
dc, err := (&config_center.MockDynamicConfigurationFactory{
Content: appName,
}).GetDynamicConfiguration(nil)
+ assert.NoError(t, err)
config.GetApplicationConfig().Name = appName
mapping := &DynamicConfigurationServiceNameMapping{dc: dc}
diff --git a/metadata/report/delegate/delegate_report_test.go b/metadata/report/delegate/delegate_report_test.go
index 9c30ed9..758395e 100644
--- a/metadata/report/delegate/delegate_report_test.go
+++ b/metadata/report/delegate/delegate_report_test.go
@@ -46,9 +46,8 @@ func TestMetadataReport_MetadataReportRetry(t *testing.T) {
})
assert.NoError(t, err)
retry.startRetryTask()
- itsTime := time.After(2500 * time.Millisecond)
select {
- case <-itsTime:
+ case <-time.After(2500 * time.Millisecond):
retry.scheduler.Clear()
assert.Equal(t, counter.Load(), int64(3))
logger.Info("over")
@@ -64,9 +63,8 @@ func TestMetadataReport_MetadataReportRetryWithLimit(t *testing.T) {
})
assert.NoError(t, err)
retry.startRetryTask()
- itsTime := time.After(2500 * time.Millisecond)
select {
- case <-itsTime:
+ case <-time.After(2500 * time.Millisecond):
retry.scheduler.Clear()
assert.Equal(t, counter.Load(), int64(2))
logger.Info("over")
diff --git a/metadata/service/inmemory/service_proxy.go b/metadata/service/inmemory/service_proxy.go
index 7e14293..8b93aab 100644
--- a/metadata/service/inmemory/service_proxy.go
+++ b/metadata/service/inmemory/service_proxy.go
@@ -39,8 +39,8 @@ import (
// this is the stub, or proxy
// for now, only GetExportedURLs need to be implemented
type MetadataServiceProxy struct {
- invkr protocol.Invoker
- golangServer bool
+ invkr protocol.Invoker
+ //golangServer bool
}
func (m *MetadataServiceProxy) GetExportedURLs(serviceInterface string, group string, version string, protocol string) ([]interface{}, error) {
@@ -67,11 +67,7 @@ func (m *MetadataServiceProxy) GetExportedURLs(serviceInterface string, group st
urlStrs := res.Result().(*[]interface{})
ret := make([]interface{}, 0, len(*urlStrs))
-
- for _, s := range *urlStrs {
- ret = append(ret, s)
- }
- return ret, nil
+ return append(ret, *urlStrs...), nil
}
func (m *MetadataServiceProxy) MethodMapper() map[string]string {
diff --git a/protocol/dubbo/dubbo_invoker_test.go b/protocol/dubbo/dubbo_invoker_test.go
index c7a9a26..fecb3b0 100644
--- a/protocol/dubbo/dubbo_invoker_test.go
+++ b/protocol/dubbo/dubbo_invoker_test.go
@@ -169,7 +169,7 @@ type (
}
UserProvider struct {
- user map[string]User
+ //user map[string]User
}
)
diff --git a/protocol/jsonrpc/http.go b/protocol/jsonrpc/http.go
index 7ab1a89..037744c 100644
--- a/protocol/jsonrpc/http.go
+++ b/protocol/jsonrpc/http.go
@@ -49,14 +49,14 @@ import (
// Request is HTTP protocol request
type Request struct {
- ID int64
- group string
- protocol string
- version string
- service string
- method string
- args interface{}
- contentType string
+ ID int64
+ group string
+ protocol string
+ version string
+ service string
+ method string
+ args interface{}
+ //contentType string
}
// ////////////////////////////////////////////
diff --git a/protocol/jsonrpc/http_test.go b/protocol/jsonrpc/http_test.go
index c4801c8..5ef4064 100644
--- a/protocol/jsonrpc/http_test.go
+++ b/protocol/jsonrpc/http_test.go
@@ -44,7 +44,7 @@ type (
}
UserProvider struct {
- user map[string]User
+ //user map[string]User
}
)
diff --git a/protocol/protocolwrapper/mock_protocol_filter.go b/protocol/protocolwrapper/mock_protocol_filter.go
index 18a4e15..d1baba8 100644
--- a/protocol/protocolwrapper/mock_protocol_filter.go
+++ b/protocol/protocolwrapper/mock_protocol_filter.go
@@ -45,5 +45,4 @@ func (pfw *mockProtocolFilter) Refer(url *common.URL) protocol.Invoker {
// Destroy will do nothing
func (pfw *mockProtocolFilter) Destroy() {
- return
}
diff --git a/registry/base_registry.go b/registry/base_registry.go
index ee0d340..e97cc1a 100644
--- a/registry/base_registry.go
+++ b/registry/base_registry.go
@@ -18,7 +18,6 @@
package registry
import (
- "context"
"fmt"
"net/url"
"os"
@@ -93,7 +92,7 @@ type FacadeBasedRegistry interface {
// BaseRegistry is a common logic abstract for registry. It implement Registry interface.
type BaseRegistry struct {
- context context.Context
+ //context context.Context
facadeBasedRegistry FacadeBasedRegistry
*common.URL
birth int64 // time of file birth, seconds since Epoch; 0 if unknown
diff --git a/registry/consul/service_discovery.go b/registry/consul/service_discovery.go
index a64fabb..6674909 100644
--- a/registry/consul/service_discovery.go
+++ b/registry/consul/service_discovery.go
@@ -252,7 +252,7 @@ func (csd *consulServiceDiscovery) GetServices() *gxset.HashSet {
return res
}
- for service, _ := range services {
+ for service := range services {
res.Add(service)
}
return res
diff --git a/registry/consul/service_discovery_test.go b/registry/consul/service_discovery_test.go
index 348790c..3f97d84 100644
--- a/registry/consul/service_discovery_test.go
+++ b/registry/consul/service_discovery_test.go
@@ -141,7 +141,8 @@ func TestConsulServiceDiscovery_CRUD(t *testing.T) {
assert.Equal(t, 1, len(page.GetData()))
instanceResult = page.GetData()[0].(*registry.DefaultServiceInstance)
- v, _ := instanceResult.Metadata["aaa"]
+ v, ok := instanceResult.Metadata["aaa"]
+ assert.True(t, ok)
assert.Equal(t, "bbb", v)
// test dispatcher event
diff --git a/registry/directory/directory.go b/registry/directory/directory.go
index f55bd4a..66d021d 100644
--- a/registry/directory/directory.go
+++ b/registry/directory/directory.go
@@ -26,7 +26,6 @@ import (
import (
perrors "github.com/pkg/errors"
- "go.uber.org/atomic"
)
import (
@@ -64,9 +63,9 @@ type RegistryDirectory struct {
configurators []config_center.Configurator
consumerConfigurationListener *consumerConfigurationListener
referenceConfigurationListener *referenceConfigurationListener
- serviceKey string
- forbidden atomic.Bool
- registerLock sync.Mutex // this lock if for register
+ //serviceKey string
+ //forbidden atomic.Bool
+ registerLock sync.Mutex // this lock if for register
}
// NewRegistryDirectory will create a new RegistryDirectory
diff --git a/registry/mock_registry.go b/registry/mock_registry.go
index 7c269c3..6287bb0 100644
--- a/registry/mock_registry.go
+++ b/registry/mock_registry.go
@@ -137,10 +137,7 @@ type listener struct {
}
func (l *listener) Next() (*ServiceEvent, error) {
- select {
- case e := <-l.listenChan:
- return e, nil
- }
+ return <-l.listenChan, nil
}
func (*listener) Close() {
diff --git a/registry/nacos/service_discovery_test.go b/registry/nacos/service_discovery_test.go
index 3b09136..2af1d5b 100644
--- a/registry/nacos/service_discovery_test.go
+++ b/registry/nacos/service_discovery_test.go
@@ -151,7 +151,8 @@ func TestNacosServiceDiscovery_CRUD(t *testing.T) {
assert.Equal(t, 1, len(page.GetData()))
instance = page.GetData()[0].(*registry.DefaultServiceInstance)
- v, _ := instance.Metadata["a"]
+ v, ok := instance.Metadata["a"]
+ assert.True(t, ok)
assert.Equal(t, "b", v)
// test dispatcher event
diff --git a/registry/zookeeper/registry.go b/registry/zookeeper/registry.go
index fe492c2..8b61e80 100644
--- a/registry/zookeeper/registry.go
+++ b/registry/zookeeper/registry.go
@@ -129,7 +129,7 @@ func (r *zkRegistry) InitListeners() {
defer oldDataListener.mutex.Unlock()
r.dataListener.closed = true
recovered := r.dataListener.subscribed
- if recovered != nil && len(recovered) > 0 {
+ if len(recovered) > 0 {
// recover all subscribed url
for _, oldListener := range recovered {
var (
diff --git a/registry/zookeeper/registry_test.go b/registry/zookeeper/registry_test.go
index 63f4b25..5959a90 100644
--- a/registry/zookeeper/registry_test.go
+++ b/registry/zookeeper/registry_test.go
@@ -57,11 +57,13 @@ func Test_UnRegister(t *testing.T) {
_ = ts.Stop()
}()
err := reg.Register(url)
+ assert.NoError(t, err)
children, _ := reg.client.GetChildren("/dubbo/com.ikurento.user.UserProvider/providers")
assert.Regexp(t, ".*dubbo%3A%2F%2F127.0.0.1%3A20000%2Fcom.ikurento.user.UserProvider%3Fanyhost%3Dtrue%26cluster%3Dmock%26.*.serviceid%3Dsoa.mock", children)
assert.NoError(t, err)
err = reg.UnRegister(url)
+ assert.NoError(t, err)
children, err = reg.client.GetChildren("/dubbo/com.ikurento.user.UserProvider/providers")
assert.Equal(t, 0, len(children))
assert.Error(t, err)
@@ -71,7 +73,6 @@ func Test_UnRegister(t *testing.T) {
children, _ = reg.client.GetChildren("/dubbo/com.ikurento.user.UserProvider/providers")
assert.Regexp(t, ".*dubbo%3A%2F%2F127.0.0.1%3A20000%2Fcom.ikurento.user.UserProvider%3Fanyhost%3Dtrue%26cluster%3Dmock%26.*.serviceid%3Dsoa.mock", children)
assert.NoError(t, err)
-
}
func Test_Subscribe(t *testing.T) {
diff --git a/registry/zookeeper/service_discovery.go b/registry/zookeeper/service_discovery.go
index 6d9582f..678c844 100644
--- a/registry/zookeeper/service_discovery.go
+++ b/registry/zookeeper/service_discovery.go
@@ -60,9 +60,9 @@ func init() {
}
type zookeeperServiceDiscovery struct {
- client *zookeeper.ZookeeperClient
- csd *curator_discovery.ServiceDiscovery
- listener *zookeeper.ZkEventListener
+ client *zookeeper.ZookeeperClient
+ csd *curator_discovery.ServiceDiscovery
+ //listener *zookeeper.ZkEventListener
url *common.URL
wg sync.WaitGroup
cltLock sync.Mutex
diff --git a/registry/zookeeper/service_discovery_test.go b/registry/zookeeper/service_discovery_test.go
index 60b3d13..b7d4677 100644
--- a/registry/zookeeper/service_discovery_test.go
+++ b/registry/zookeeper/service_discovery_test.go
@@ -75,7 +75,9 @@ func TestNewZookeeperServiceDiscovery(t *testing.T) {
func TestCURDZookeeperServiceDiscovery(t *testing.T) {
ts := prepareData(t)
- defer ts.Stop()
+ defer func() {
+ _ = ts.Stop()
+ }()
sd, err := newZookeeperServiceDiscovery(testName)
assert.Nil(t, err)
defer func() {
@@ -143,7 +145,9 @@ func TestCURDZookeeperServiceDiscovery(t *testing.T) {
func TestAddListenerZookeeperServiceDiscovery(t *testing.T) {
ts := prepareData(t)
- defer ts.Stop()
+ defer func() {
+ _ = ts.Stop()
+ }()
sd, err := newZookeeperServiceDiscovery(testName)
assert.Nil(t, err)
defer func() {
@@ -176,7 +180,7 @@ func TestAddListenerZookeeperServiceDiscovery(t *testing.T) {
extension.SetAndInitGlobalDispatcher("direct")
extension.GetGlobalDispatcher().AddEventListener(sicl)
err = sd.AddListener(sicl)
- assert.Nil(t, err)
+ assert.NoError(t, err)
err = sd.Update(®istry.DefaultServiceInstance{
Id: "testId",
@@ -187,6 +191,7 @@ func TestAddListenerZookeeperServiceDiscovery(t *testing.T) {
Healthy: true,
Metadata: nil,
})
+ assert.NoError(t, err)
tn.wg.Wait()
}
diff --git a/remoting/etcdv3/client_test.go b/remoting/etcdv3/client_test.go
index 181f5c6..787c24d 100644
--- a/remoting/etcdv3/client_test.go
+++ b/remoting/etcdv3/client_test.go
@@ -108,7 +108,6 @@ func (suite *ClientTestSuite) SetupSuite() {
}
suite.etcd = e
- return
}
// stop etcd server
@@ -136,7 +135,6 @@ func (suite *ClientTestSuite) SetupTest() {
err := c.CleanKV()
suite.Nil(err)
suite.client = c
- return
}
func (suite *ClientTestSuite) TestClientClose() {
diff --git a/remoting/getty/getty_client_test.go b/remoting/getty/getty_client_test.go
index 982c509..c32e0c2 100644
--- a/remoting/getty/getty_client_test.go
+++ b/remoting/getty/getty_client_test.go
@@ -396,6 +396,7 @@ func InitTest(t *testing.T) (*Server, *common.URL) {
"environment=dev&interface=com.ikurento.user.UserProvider&ip=127.0.0.1&methods=GetUser%2C&" +
"module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" +
"side=provider&timeout=3000×tamp=1556509797245&bean.name=UserProvider")
+ assert.NoError(t, err)
// init server
userProvider := &UserProvider{}
_, err = common.ServiceMap.Register("", url.Protocol, "", "0.0.1", userProvider)
@@ -432,7 +433,7 @@ type (
}
UserProvider struct {
- user map[string]User
+ //user map[string]User
}
)
diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go
index c70aeea..77f6cff 100644
--- a/remoting/getty/pool.go
+++ b/remoting/getty/pool.go
@@ -91,7 +91,7 @@ func newGettyRPCClientConn(pool *gettyRPCClientPool, addr string) (*gettyRPCClie
break
}
- if time.Now().Sub(start) > connectTimeout {
+ if time.Since(start) > connectTimeout {
c.gettyClient.Close()
return nil, perrors.New(fmt.Sprintf("failed to create client connection to %s in %s", addr, connectTimeout))
}
@@ -314,9 +314,7 @@ func (c *gettyRPCClient) close() error {
c.gettyClient = nil
sessions = make([]*rpcSession, 0, len(c.sessions))
- for _, s := range c.sessions {
- sessions = append(sessions, s)
- }
+ sessions = append(sessions, c.sessions...)
c.sessions = c.sessions[:0]
}()
diff --git a/remoting/kubernetes/facade_test.go b/remoting/kubernetes/facade_test.go
index 00e2e11..a6c6c02 100644
--- a/remoting/kubernetes/facade_test.go
+++ b/remoting/kubernetes/facade_test.go
@@ -19,7 +19,6 @@ package kubernetes
import (
"strconv"
- "sync"
"testing"
)
@@ -30,9 +29,9 @@ import (
type mockFacade struct {
*common.URL
- client *Client
- cltLock sync.Mutex
- done chan struct{}
+ client *Client
+ //cltLock sync.Mutex
+ //done chan struct{}
}
func (r *mockFacade) Client() *Client {