List of function args


I’m in the process of converting a python lib to go.

I have difficulties to reproduce a python function: inspect.getargspec(method)

Which basically an introspection function, that takes a function as parameter, and returns the list of all the arguments for this function.

Is there something similar I can use in Go?

Thanks for your help.


Your best shoot is golangs reflection package

Out of curiosity. Why do you need this?

In short, the lib is a UDP multicast protocol. And each node need to announce the functions it provides. (along with the parameters) like a discovery protocol.

Looks like I can retrieve the args type, using reflect.In, but I can’t figure out how to get the args names.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.