interact: scan all return values

This commit is contained in:
c9s 2022-01-13 02:06:29 +08:00
parent cf2d9ca226
commit ba4c694179

View File

@ -243,8 +243,13 @@ func parseFuncArgsAndCall(f interface{}, args []string, objects ...interface{})
}
out := fv.Call(rArgs)
if ft.NumOut() > 0 {
outType := ft.Out(0)
if ft.NumOut() == 0 {
return nil
}
// try to get the error object from the return value
for i := 0; i < ft.NumOut(); i++ {
outType := ft.Out(i)
switch outType.Kind() {
case reflect.Interface:
o := out[0].Interface()