mardi 25 décembre 2018

How to determine number of values returned by a function

How can I get a function's return value length, the effect will be similar to below:

func Foo() (int, int){
    ...
}
func Bar() (int, float, bool, string, error){
    ...
}
n1 := getReturnLength(Foo) // shall be 2
n2 := getReturnLength(Bar) // shall be 5

How shall I do to implement the getReturnLength function or something equal?





Aucun commentaire:

Enregistrer un commentaire