by zetetic · 7y ago · 0 comments
type Person {
Name string `protobuf:"name",json:"given_name"`
}Use it like:
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
...
Type myField = 1 [(gogoproto.jsontag) = "my-field"];Have you seen Protobuf options [1]? They allow for a tag-like-behaviour, but are strongly typed. It's notably used by gogoproto [2] to allow specifying custom field types or names [3] when generating Go stubs.
[1] - https://developers.google.com/protocol-buffers/docs/proto#cu...