Skip to content

Commit

Permalink
interact: scan all return values
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jan 13, 2022
1 parent cf2d9ca commit ba4c694
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/interact/interact.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ba4c694

Please sign in to comment.