This is an automated email from the ASF dual-hosted git repository.
laurence pushed a commit to branch hsf-go-dependency
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/hsf-go-dependency by this push:
new 3782865 fix: pb stub function bug (#1421)
3782865 is described below
commit 3782865caf52ed9c570065420206876782c74577
Author: Laurence <[email protected]>
AuthorDate: Mon Aug 30 16:53:09 2021 +0800
fix: pb stub function bug (#1421)
---
common/rpc_service.go | 7 +++++++
config/config_api.go | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/common/rpc_service.go b/common/rpc_service.go
index dc10e2a..07a786b 100644
--- a/common/rpc_service.go
+++ b/common/rpc_service.go
@@ -387,6 +387,13 @@ func suiteMethod(method reflect.Method) *MethodType {
return nil
}
+ if outNum != 1 && outNum != 2 {
+ // todo 1.5/3.0's complicated logger
+ logger.Warnf("method %s of mtype %v has wrong number of in out
parameters %d; needs exactly 1/2",
+ mname, mtype.String(), outNum)
+ return nil
+ }
+
// The latest return type of the method must be error.
if returnType := mtype.Out(outNum - 1); returnType != typeOfError {
if mname != METHOD_MAPPER {
diff --git a/config/config_api.go b/config/config_api.go
index eac5a79..85a3829 100644
--- a/config/config_api.go
+++ b/config/config_api.go
@@ -462,6 +462,14 @@ func WithServiceCluster(cluster string) ServiceConfigOpt {
}
}
+// WithServiceParams returns ServiceConfigOpt with given params map @params
+func WithServiceParams(params map[string]string) ServiceConfigOpt {
+ return func(config *ServiceConfig) *ServiceConfig {
+ config.Params = params
+ return config
+ }
+}
+
// WithServiceMethod returns ServiceConfigOpt with given @name, @retries and
load balance @lb
func WithServiceMethod(name, retries, lb string) ServiceConfigOpt {
return func(config *ServiceConfig) *ServiceConfig {