Closed myitcv closed 9 years ago
Well, here's a hack-y solution:
//go:generate msgp
//msgp:tuple MethodRetvals
//go:generate gorename -from "path/to/pkg".MethodRetVals.DecodeMsg -to deleteme
//go:generate gorename -from "path/to/pkg".MethodArgs.EncodeMsg - to deleteme
... and then delete methods named "deleteme" using the gross regex/tool of your choice. (I couldn't figure out a quick way to delete a method using gofmt or gorename, but I'm sure it's possible.)
@philhofer - that certainly works as a solution (hadn't considered it to be honest!)
e.g. in pseudo code:
would cause only the
DecodeMsg
method to be generated (but not any of the marshall-related methods or theEncodeMsg
)The use case here is again MSGPACK RPC. I want to be able to generate a decoder for one
struct
(the args to the method) and an encoder for another (the return values). Then combine those two structs into a wrapperstruct
along the following lines:I can then unambiguously call
DecodeMsg
on an instance of theMethodWrapper
Thoughts?