Skip to content

Feature request: xxxtags (moretags for XXX_* fields) #647

@oceanful

Description

@oceanful

As requested in https://groups.google.com/forum/#!topic/gogoprotobuf/xmFnqAS6MIc

it would very useful to be able to set struct tags on the XXX_* fields, so that they can be ignored when used for other serialization formats. (For example, the json:"_" struct tag is already added to those fields by default.)

type Station struct {
	AlignmentId          string   `protobuf:"bytes,1,opt,name=alignment_id,json=alignmentId,proto3" json:"alignment_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Would it be possible to have a message-level option called xxxtags, and a file-level analog xxxtags_all?

message Station {
  option (gogoproto.xxxtags) = "firestore:\"-\"";

  string alignment_id = 1;
};

to generate:

type Station struct {
	AlignmentId          string   `protobuf:"bytes,1,opt,name=alignment_id,json=alignmentId,proto3" json:"alignment_id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-" firestore:"-"`
	XXX_sizecache        int32    `json:"-" firestore:"-"`
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions