This is an automated email from the ASF dual-hosted git repository. mark4z pushed a commit to branch 1.0.0 in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git
commit d258c957a5d79b8abee8aaf293bf0dfadb83a566 Author: Mengchao.Lv1 <Mengchao.Lv1@a.c> AuthorDate: Sat Dec 2 19:44:02 2023 +0800 remove unused types JTypeMapper check & support default types. --- pixiu/pkg/client/dubbo/option.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pixiu/pkg/client/dubbo/option.go b/pixiu/pkg/client/dubbo/option.go index 41980f73..7ed47bc4 100644 --- a/pixiu/pkg/client/dubbo/option.go +++ b/pixiu/pkg/client/dubbo/option.go @@ -186,24 +186,22 @@ type paramTypesOpt struct{} // Action for paramTypesOpt override the other param types mapping/config. // The val must be string(e.g. "int, object"), and will then assign to the target.(dubboTarget).Types func (opt *paramTypesOpt) Action(target, val interface{}) error { - v, ok := val.(string) - if !ok { - return errors.New("The val type must be string") - } - types := strings.Split(v, ",") dubboTarget, ok := target.(*dubboTarget) if !ok { return errors.New("Target is not dubboTarget in target parameter") } - for i := range types { - trimType := strings.TrimSpace(types[i]) - if len(trimType) == 0 { - continue - } - if _, ok = constant.JTypeMapper[trimType]; !ok { - return errors.Errorf("Types invalid %s", trimType) + // empty types for func like func() + var types []string + if v, ok := val.(string); ok { + if len(v) > 0 { + types = strings.Split(v, ",") + if !ok { + return errors.New("Target is not dubboTarget in target parameter") + } + for i := range types { + types[i] = strings.TrimSpace(types[i]) + } } - types[i] = trimType } dubboTarget.Types = types return nil