lundi 13 juillet 2015

Getting method parameter names in Golang

Given I have a golang function

TMethod(data *testData) (interface{}, *error) {
    ...
}

I want to reflect the name of the parameter (which here its data).

I tried the fallowing, but it returns the structure name (which here its testData)

reflect.ValueOf(T)MethodByName("TMethod").Type().In(0).Elem().Name()

How can I get it





Aucun commentaire:

Enregistrer un commentaire