diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go index f0467d9b5c9d31f65bbc35308471a2812372886c..061d832b0328a5e1754c7804bf40cf83ac216a8b 100644 --- a/registry/servicediscovery/service_discovery_registry.go +++ b/registry/servicediscovery/service_discovery_registry.go @@ -342,7 +342,7 @@ func shouldSubscribe(url common.URL) bool { func (s *serviceDiscoveryRegistry) getServices(url common.URL) *gxset.HashSet { services := gxset.NewSet() serviceNames := url.GetParam(constant.PROVIDER_BY, "") - if len(serviceNames) != 0 { + if len(serviceNames) > 0 { services = parseServices(serviceNames) } if services.Empty() { @@ -486,7 +486,7 @@ func (s *serviceDiscoveryRegistry) initSelectedRevisionExportedURLs(serviceInsta for range serviceInstances { selectServiceInstance := s.selectServiceInstance(serviceInstances) revisionExportedURLs := s.initRevisionExportedURLsByInst(selectServiceInstance) - if len(revisionExportedURLs) != 0 { + if len(revisionExportedURLs) > 0 { // If the result is valid,break break } @@ -565,7 +565,7 @@ func getExportedStoreType(serviceInstance registry.ServiceInstance) string { } func (s *serviceDiscoveryRegistry) cloneExportedURLs(url common.URL, serviceInsances []registry.ServiceInstance) []common.URL { - if serviceInsances == nil || len(serviceInsances) == 0 { + if len(serviceInsances) == 0 { return []common.URL{} } var clonedExportedURLs []common.URL diff --git a/remoting/etcdv3/client.go b/remoting/etcdv3/client.go index 9e639b6e41312e78c9178c7c3e204bf4e9518fda..7632a7cd042d36db5e02280a14224b83e8736e6c 100644 --- a/remoting/etcdv3/client.go +++ b/remoting/etcdv3/client.go @@ -131,7 +131,7 @@ func ValidateClient(container clientFacade, opts ...Option) error { return nil } -// NewServiceDiscoveryClient +// nolint func NewServiceDiscoveryClient(opts ...Option) *Client { options := &Options{ heartbeat: 1, // default heartbeat diff --git a/remoting/zookeeper/curator_discovery/service_discovery.go b/remoting/zookeeper/curator_discovery/service_discovery.go index 6924507b140c000794b002559f662d8e22999710..9566b5494389325520b4eb6a8eb170e0b305bb47 100644 --- a/remoting/zookeeper/curator_discovery/service_discovery.go +++ b/remoting/zookeeper/curator_discovery/service_discovery.go @@ -25,12 +25,11 @@ import ( ) import ( + "github.com/dubbogo/go-zookeeper/zk" perrors "github.com/pkg/errors" ) import ( - "github.com/dubbogo/go-zookeeper/zk" - "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/remoting"