I have an idea to use interfaces in Go to define RPC style interfaces. So for a given service, I might create an interface like this:
type MyService interface{
Login(username, password string) (sessionId int, err error)
HelloWorld(sessionId int) (hi string, err error)
}
What I would like to do is use reflection to implement that interface, translating method calls into RPC calls, Marshaling the input parameters, and Unmarshaling the results back into the output of the method. I know that if I can get a []interface{} of the input parameters I can use reflection to make the service call. However I don't see any way to use reflection to dynamically create a value that would implement the interface by calling my reflection-using functions. Does anyone know of a way to do this, even using unsafe?