Skip to content

Commit

Permalink
chore: Remove unnecessary return and judgement.
Browse files Browse the repository at this point in the history
  • Loading branch information
atlas-comstock committed Aug 28, 2020
1 parent d0bfafb commit e1a0284
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 40 deletions.
9 changes: 2 additions & 7 deletions common/rpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ import (
"sync"
"unicode"
"unicode/utf8"
)

import (
perrors "github.com/pkg/errors"
)

import (
"github.com/apache/dubbo-go/common/logger"
perrors "github.com/pkg/errors"
)

// RPCService
Expand Down Expand Up @@ -271,7 +266,7 @@ func (sm *serviceMap) UnRegister(interfaceName, protocol, serviceId string) erro
sm.mutex.Lock()
defer sm.mutex.Unlock()
sm.interfaceMap[interfaceName] = make([]*Service, 0, len(svrs))
for i, _ := range svrs {
for i := range svrs {
if i != index {
sm.interfaceMap[interfaceName] = append(sm.interfaceMap[interfaceName], svrs[i])
}
Expand Down
13 changes: 3 additions & 10 deletions config/base_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ import (
"reflect"
"strconv"
"strings"
)

import (
perrors "github.com/pkg/errors"
)

import (
"github.com/apache/dubbo-go/common/config"
"github.com/apache/dubbo-go/common/logger"
perrors "github.com/pkg/errors"
)

type multiConfiger interface {
Expand Down Expand Up @@ -216,10 +211,8 @@ func setFieldValue(val reflect.Value, id reflect.Value, config *config.InmemoryC
prefix := s.MethodByName("Prefix").Call(nil)[0].String()
for _, pfx := range strings.Split(prefix, "|") {
m := config.GetSubProperty(pfx)
if m != nil {
for k := range m {
f.SetMapIndex(reflect.ValueOf(k), reflect.New(f.Type().Elem().Elem()))
}
for k := range m {
f.SetMapIndex(reflect.ValueOf(k), reflect.New(f.Type().Elem().Elem()))
}

}
Expand Down
7 changes: 1 addition & 6 deletions config/reference_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,16 @@ import (
"net/url"
"strconv"
"time"
)

import (
"github.com/creasty/defaults"
gxstrings "github.com/dubbogo/gost/strings"
)

import (
"github.com/apache/dubbo-go/cluster/directory"
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/proxy"
"github.com/apache/dubbo-go/protocol"
gxstrings "github.com/dubbogo/gost/strings"
)

// ReferenceConfig is the configuration of service consumer
Expand Down Expand Up @@ -251,5 +247,4 @@ func (c *ReferenceConfig) GenericLoad(id string) {
c.id = id
c.Refer(genericService)
c.Implement(genericService)
return
}
2 changes: 0 additions & 2 deletions filter/filter_impl/access_log_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import (
"reflect"
"strings"
"time"
)

import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/logger"
Expand Down
3 changes: 0 additions & 3 deletions protocol/rest/rest_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package rest

import (
"sync"
)

import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/logger"
Expand Down Expand Up @@ -49,5 +47,4 @@ func (re *RestExporter) Unexport() {
if err != nil {
logger.Errorf("[RestExporter.Unexport] error: %v", err)
}
return
}
10 changes: 4 additions & 6 deletions registry/protocol/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ import (
"context"
"strings"
"sync"
)
import (
gxset "github.com/dubbogo/gost/container/set"
)

import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config"
"github.com/apache/dubbo-go/config_center"
gxset "github.com/dubbogo/gost/container/set"

_ "github.com/apache/dubbo-go/config_center/configurator"
"github.com/apache/dubbo-go/protocol"
"github.com/apache/dubbo-go/protocol/protocolwrapper"
"github.com/apache/dubbo-go/registry"

_ "github.com/apache/dubbo-go/registry/directory"
"github.com/apache/dubbo-go/remoting"
)
Expand Down Expand Up @@ -103,7 +101,7 @@ func filterHideKey(url *common.URL) *common.URL {

// be careful params maps in url is map type
removeSet := gxset.NewSet()
for k, _ := range url.GetParams() {
for k := range url.GetParams() {
if strings.HasPrefix(k, ".") {
removeSet.Add(k)
}
Expand Down
7 changes: 1 addition & 6 deletions remoting/zookeeper/curator_discovery/service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ import (
"path"
"strings"
"sync"
)

import (
"github.com/dubbogo/go-zookeeper/zk"
perrors "github.com/pkg/errors"
)

import (
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/remoting"
"github.com/apache/dubbo-go/remoting/zookeeper"
perrors "github.com/pkg/errors"
)

// Entry contain a service instance
Expand Down Expand Up @@ -154,7 +150,6 @@ func (sd *ServiceDiscovery) updateInternalService(name, id string) {
return
}
entry.instance = instance
return
}

// UnregisterService un-register service in zookeeper and delete service in cache
Expand Down

0 comments on commit e1a0284

Please sign in to comment.