Skip to content
Snippets Groups Projects
Commit 925c47c3 authored by Patrick's avatar Patrick
Browse files

optimize code

parent ecbabb3e
Branches
Tags
No related merge requests found
......@@ -64,16 +64,9 @@ func (ef *GenericServiceFilter) Invoke(invoker protocol.Invoker, invocation prot
// oldParams convert to newParams
for i := range argsType {
var newParam interface{}
if argsType[i].Kind() == reflect.Ptr {
newParam = reflect.New(argsType[i].Elem()).Interface()
err = mapstructure.Decode(oldParams[i], newParam)
} else if argsType[i].Kind() == reflect.Struct || argsType[i].Kind() == reflect.Slice {
newParam = reflect.New(argsType[i]).Interface()
err = mapstructure.Decode(oldParams[i], newParam)
newParam = reflect.ValueOf(newParam).Elem().Interface()
} else {
newParam = oldParams[i]
}
if err != nil {
logger.Errorf("[Generic Service Filter] decode arguments map to struct wrong")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment