reflect.ValueOf(f)Try instead reflect.TypeOf(f). A type Typehas two corresponding methods named NumOutand Out(int). To get all return values ββin order, you can use the following loop
typ := reflect.TypeOf(f)
for i := 0; i < typ.NumOut(); i++ {
returnType := typ.Out(i)
// do something with returnType
}
If you are sure that your function has only one return value, you can always get it using Out(0)standard failures, make sure that your input is correct.