Given an interface containing functions with varying parameters and a concrete implementation of that interface how do I take a stream of bytes and call methods from the interface based on that byte stream. Basically an RPC call.
e.g.
type funcs interface {
func Hello(name string) (string, error)
func Add(numbers...int) (result, error)
}
And lets say I had the following input data
Hello John
Add 1 2 3 4
I figure this has to be done with reflection but this package I find a bit of mystery to use. Not great examples. Looking at RPC packages is also a bit mysterious. I don't understand what they are doing and there seem to be limitations or assumptions, perhaps to make the code simpler and/or faster to implement.
Can someone shed some light on how I might take the string "Hello" and find the function handle "Hello" from the funcs table. And know that it's expecting a single parameter that is a string and then calling that function with the argument provided "John".