Skip to content

Instantly share code, notes, and snippets.

@maxtaco
Last active October 7, 2015 00:54
Show Gist options
  • Save maxtaco/3fb52a0da9421477d497 to your computer and use it in GitHub Desktop.
Save maxtaco/3fb52a0da9421477d497 to your computer and use it in GitHub Desktop.
New RPC/Go interface idea.
@namespace("foo.1")
protocol bar {
A myfunc(b B, c C);
}
type MyfuncArg struct {
B B;
C C;
}
func BarProtocol(i BarInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.bar",
Methods: map[string]rpc.ServeHookDescription{
"myfunc" : rpc.ServeHookDescription{
ArgType : reflect.TypeOf(MyfuncArg),
Func : func(arg interface{}) (ret interface{}, err error) {
return i.Myfunc(arg);
},
},
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment