Hello,
I’m in the process of converting a python lib to go.
I have difficulties to reproduce a python function: inspect.getargspec(method)
https://docs.python.org/2/library/inspect.html#inspect.getargspec
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.
Hi
Your best shoot is golangs reflection package https://golang.org/pkg/reflect/
Out of curiosity. Why do you need this?
Thanks,
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.
system
(system)
Closed
January 23, 2019, 3:35pm
5
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.