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{
I think it might be possible to achieve what you want if one could fully implement the reflect.Type
interface, which you can't (unexported methods). Then it could, maybe, be possible to instantiate your custom type by using unsafe_New
.
All in all it is not a good idea to do so.
The next best thing to what you want is probably to use something like gob. You can use gob as intermediate language, read the methods from your interface using reflection, write them as gob and decode the created gob code to real Go objects. But I'm not sure if that's worth it.
Most of the time you're safer by manually implementing your interface on the client side and forwarding the method calls.