I have a message like
message Response {
google.protobuf.Any id = 1;
string message = 3;
}
and I would like to encode either an int32 or string in ID.
I can achieve this by making some wrapper type
message IntWrapper {
int32 id = 1;
}
and using ptypes.MarshalAny from github.com/golang/protobuf/ptypes to marshal my new types since they implement proto.Message.
ptypes.MarshalAny(&myproto.IntWrapper{Id: 1})
I'd like to do this without the wrappers. Are there implementations of proto.Message somewhere for plain int32's or string's or another way to do this?
(Footnote: I do not want to implement proto.Message, but have it provided or autogenerated)