You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/05/22 10:54:28 UTC

[GitHub] [dubbo-go] zouyx commented on a change in pull request #529: Fix: gitee code analysis shadow err

zouyx commented on a change in pull request #529:
URL: https://github.com/apache/dubbo-go/pull/529#discussion_r429176060



##########
File path: cluster/directory/static_directory.go
##########
@@ -61,7 +61,7 @@ func (dir *staticDirectory) IsAvailable() bool {
 // List List invokers
 func (dir *staticDirectory) List(invocation protocol.Invocation) []protocol.Invoker {
 	l := len(dir.invokers)
-	invokers := make([]protocol.Invoker, l, l)
+	invokers := make([]protocol.Invoker, l)

Review comment:
       why delete capacity ?

##########
File path: cluster/directory/base_directory.go
##########
@@ -92,7 +92,7 @@ func (dir *BaseDirectory) SetRouters(urls []*common.URL) {
 			factory := extension.GetRouterFactory(url.Protocol)
 			r, err := factory.NewRouter(url)
 			if err != nil {
-				logger.Errorf("Create router fail. router key: %s, error: %v", routerKey, url.Service(), err)
+				logger.Errorf("Create router fail. router key: %s, url:%s, error: %s", routerKey, url.Service(), err.Error())

Review comment:
       ```suggestion
   				logger.Errorf("Create router fail. router key: %s, url:%s, error: %+v", routerKey, url.Service(), err.Error())
   ```

##########
File path: registry/kubernetes/registry_test.go
##########
@@ -68,7 +68,7 @@ func (s *KubernetesRegistryTestSuite) TestSubscribe() {
 	time.Sleep(1e9)
 
 	go func() {
-		err := r.Register(url)
+		err = r.Register(url)

Review comment:
       i think assign to `err` outside goroutine should cause concurrent problems

##########
File path: filter/filter_impl/hystrix_filter.go
##########
@@ -124,7 +124,7 @@ func (hf *HystrixFilter) Invoke(ctx context.Context, invoker protocol.Invoker, i
 	_, _, err := hystrix.GetCircuit(cmdName)
 	configLoadMutex.RUnlock()
 	if err != nil {
-		logger.Errorf("[Hystrix Filter]Errors occurred getting circuit for %s , will invoke without hystrix, error is: ", cmdName, err)
+		logger.Errorf("[Hystrix Filter]Errors occurred getting circuit for %s , will invoke without hystrix, error is: %s", cmdName, err.Error())

Review comment:
       ```suggestion
   		logger.Errorf("[Hystrix Filter]Errors occurred getting circuit for %s , will invoke without hystrix, error is: %+v", cmdName, err.Error())
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org