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


The following commit(s) were added to refs/heads/develop by this push:
     new f3614e9d5 fix/return err (#2763)
f3614e9d5 is described below

commit f3614e9d55b693744342009aa4362c546396adf3
Author: xinfan.wu <[email protected]>
AuthorDate: Tue Dec 17 17:41:25 2024 +0800

    fix/return err (#2763)
    
    * fix:set url to nil when destroy base invoker and change the order of 
related references to avoid panic
    
    * fix err return which issued in issue2762
---
 config/tls_config.go                             | 5 +++--
 global/registry_config.go                        | 5 +++--
 protocol/triple/internal/client/common/client.go | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/config/tls_config.go b/config/tls_config.go
index 7066484d9..2802a23b5 100644
--- a/config/tls_config.go
+++ b/config/tls_config.go
@@ -20,6 +20,7 @@ package config
 import (
        "crypto/tls"
        "crypto/x509"
+       "errors"
        "os"
 )
 
@@ -55,7 +56,7 @@ func GetServerTlsConfig(opt *TLSConfig) (*tls.Config, error) {
                        return nil, err
                }
                if ok := ca.AppendCertsFromPEM(caBytes); !ok {
-                       return nil, err
+                       return nil, errors.New("failed to parse root 
certificate")
                }
                cfg.ClientAuth = tls.RequireAndVerifyClientCert
                cfg.ClientCAs = ca
@@ -85,7 +86,7 @@ func GetClientTlsConfig(opt *TLSConfig) (*tls.Config, error) {
                return nil, err
        }
        if ok := ca.AppendCertsFromPEM(caBytes); !ok {
-               return nil, err
+               return nil, errors.New("failed to parse root certificate")
        }
        cfg.RootCAs = ca
        //need mTls
diff --git a/global/registry_config.go b/global/registry_config.go
index 9daba7ce5..20f89cc14 100644
--- a/global/registry_config.go
+++ b/global/registry_config.go
@@ -17,12 +17,13 @@
 
 package global
 
-import "strconv"
+import (
+       "strconv"
+)
 
 // todo(DMwangnima): finish refactoring and move related logic from config 
package to this file.
 // This RegistryConfig is a copy of /config/RegistryConfig right now.
 // Please refer to issue(https://github.com/apache/dubbo-go/issues/2377).
-
 // RegistryConfig is the configuration of the registry center
 type RegistryConfig struct {
        Protocol          string            `validate:"required" 
yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
diff --git a/protocol/triple/internal/client/common/client.go 
b/protocol/triple/internal/client/common/client.go
index c83274ff0..0da91cb74 100644
--- a/protocol/triple/internal/client/common/client.go
+++ b/protocol/triple/internal/client/common/client.go
@@ -65,7 +65,7 @@ func testBidiStream(cli greettriple.GreetService) error {
                return err
        }
        if sendErr := stream.Send(&greet.GreetStreamRequest{Name: "triple"}); 
sendErr != nil {
-               return err
+               return sendErr
        }
        resp, err := stream.Recv()
        if err != nil {
@@ -89,7 +89,7 @@ func testClientStream(cli greettriple.GreetService) error {
        }
        for i := 0; i < 5; i++ {
                if sendErr := stream.Send(&greet.GreetClientStreamRequest{Name: 
"triple"}); sendErr != nil {
-                       return err
+                       return sendErr
                }
        }
        resp, err := stream.CloseAndRecv()

Reply via email to