I am using google grpc with a json proxy. for some reason i need to remove the omitempty
tags from the struct generated in the *.pb.go files.
if i have a proto message like this
message Status {
int32 code = 1;
string message = 2;
}
The generated struct looks like this
type Status struct {
Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
}
But My need is to remove the omitempty
tag from the generated structs. How can i do this?
0
value, it will be omitted and thus the field will be left unchanged - properly leaving with value0
if you used a zero-value struct (which you should anyway). – Telegramstruct.Field = proto.Uint64(0)
it should not be empty. – Turk