Reputation: 25934
I am trying to generate go structs incl. json tags.
I can do:
string name = 1 [json_name="item.name, omitempty"];
But that only generates - json=item.name and only json:"name,omitempty"
Name string `protobuf:"bytes,1,opt,name=name,json=item.name, omitempty,proto3" json:"name,omitempty"`
But I need:- json:"item.name,omitempty" Note the tag is missing "item.". And it looks like no matter what you put in json_name it is not reflected in "json:"
Du you know how to set json tags?
Upvotes: 2
Views: 4192
Reputation: 801
Not supported. The proto file json_name
is not used to generate the code.
https://github.com/golang/protobuf/issues/52
I also thought it was a bug https://github.com/golang/protobuf/issues/998
Upvotes: 1