cmd/protoc-gen-go: generate oneof types seperately

Seperate out the generation of the oneof wrapper types from the
code block that is about getter methods.

Change-Id: Ief44ef953d0b5ad8c998a8542c830ca70468a3bf
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/171029
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-04-08 14:03:15 -07:00 committed by Joe Tsai
parent 53b05a5d53
commit 872b50047a
12 changed files with 540 additions and 530 deletions

View File

@ -476,10 +476,8 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
// Getter methods. // Getter methods.
for _, field := range message.Fields { for _, field := range message.Fields {
if field.OneofType != nil { if isFirstOneofField(field) {
if field == field.OneofType.Fields[0] { genOneofGetter(gen, g, f, message, field.OneofType)
genOneofTypes(gen, g, f, message, field.OneofType)
}
} }
goType, pointer := fieldGoType(g, field) goType, pointer := fieldGoType(g, field)
defaultValue := fieldDefaultValue(g, message, field) defaultValue := fieldDefaultValue(g, message, field)
@ -510,9 +508,15 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
g.P() g.P()
} }
// XXX_OneofWrappers method.
if len(message.Oneofs) > 0 { if len(message.Oneofs) > 0 {
genOneofWrappers(gen, g, f, message) genOneofWrappers(gen, g, f, message)
} }
// Oneof wrapper types.
for _, oneof := range message.Oneofs {
genOneofTypes(gen, g, f, message, oneof)
}
} }
// fieldGoType returns the Go type used for a field. // fieldGoType returns the Go type used for a field.
@ -739,11 +743,35 @@ func genOneofField(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo,
g.P(oneofFieldName(oneof), " ", oneofInterfaceName(oneof), " `protobuf_oneof:\"", oneof.Desc.Name(), "\"`") g.P(oneofFieldName(oneof), " ", oneofInterfaceName(oneof), " `protobuf_oneof:\"", oneof.Desc.Name(), "\"`")
} }
// genOneofGetter generate a Get method for a oneof.
func genOneofGetter(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message, oneof *protogen.Oneof) {
g.Annotate(message.GoIdent.GoName+".Get"+oneof.GoName, oneof.Location)
g.P("func (m *", message.GoIdent.GoName, ") Get", oneof.GoName, "() ", oneofInterfaceName(oneof), " {")
g.P("if m != nil {")
g.P("return m.", oneofFieldName(oneof))
g.P("}")
g.P("return nil")
g.P("}")
g.P()
}
// genOneofWrappers generates the XXX_OneofWrappers method for a message.
func genOneofWrappers(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {
g.P("// XXX_OneofWrappers is for the internal use of the proto package.")
g.P("func (*", message.GoIdent.GoName, ") XXX_OneofWrappers() []interface{} {")
g.P("return []interface{}{")
for _, oneof := range message.Oneofs {
for _, field := range oneof.Fields {
g.P("(*", fieldOneofType(field), ")(nil),")
}
}
g.P("}")
g.P("}")
g.P()
}
// genOneofTypes generates the interface type used for a oneof field, // genOneofTypes generates the interface type used for a oneof field,
// and the wrapper types that satisfy that interface. // and the wrapper types that satisfy that interface.
//
// It also generates the getter method for the parent oneof field
// (but not the member fields).
func genOneofTypes(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message, oneof *protogen.Oneof) { func genOneofTypes(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message, oneof *protogen.Oneof) {
ifName := oneofInterfaceName(oneof) ifName := oneofInterfaceName(oneof)
g.P("type ", ifName, " interface {") g.P("type ", ifName, " interface {")
@ -767,14 +795,11 @@ func genOneofTypes(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo,
g.P("func (*", fieldOneofType(field), ") ", ifName, "() {}") g.P("func (*", fieldOneofType(field), ") ", ifName, "() {}")
g.P() g.P()
} }
g.Annotate(message.GoIdent.GoName+".Get"+oneof.GoName, oneof.Location) }
g.P("func (m *", message.GoIdent.GoName, ") Get", oneof.GoName, "() ", ifName, " {")
g.P("if m != nil {") // isFirstOneofField reports whether this is the first field in a oneof.
g.P("return m.", oneofFieldName(oneof)) func isFirstOneofField(field *protogen.Field) bool {
g.P("}") return field.OneofType != nil && field.OneofType.Fields[0] == field
g.P("return nil")
g.P("}")
g.P()
} }
// oneofFieldName returns the name of the struct field holding the oneof value. // oneofFieldName returns the name of the struct field holding the oneof value.
@ -791,21 +816,6 @@ func oneofInterfaceName(oneof *protogen.Oneof) string {
return fmt.Sprintf("is%s_%s", oneof.ParentMessage.GoIdent.GoName, oneof.GoName) return fmt.Sprintf("is%s_%s", oneof.ParentMessage.GoIdent.GoName, oneof.GoName)
} }
// genOneofWrappers generates the XXX_OneofWrappers method for a message.
func genOneofWrappers(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {
g.P("// XXX_OneofWrappers is for the internal use of the proto package.")
g.P("func (*", message.GoIdent.GoName, ") XXX_OneofWrappers() []interface{} {")
g.P("return []interface{}{")
for _, oneof := range message.Oneofs {
for _, field := range oneof.Fields {
g.P("(*", fieldOneofType(field), ")(nil),")
}
}
g.P("}")
g.P("}")
g.P()
}
// fieldOneofType returns the wrapper type used to represent a field in a oneof. // fieldOneofType returns the wrapper type used to represent a field in a oneof.
func fieldOneofType(field *protogen.Field) protogen.GoIdent { func fieldOneofType(field *protogen.Field) protogen.GoIdent {
ident := protogen.GoIdent{ ident := protogen.GoIdent{

View File

@ -60,16 +60,6 @@ func (x *Message1) GetField1A() string {
return "" return ""
} }
type isMessage1_Oneof1A interface {
isMessage1_Oneof1A()
}
type Message1_Oneof1AField1 struct {
Oneof1AField1 string `protobuf:"bytes,2,opt,name=Oneof1AField1,oneof"`
}
func (*Message1_Oneof1AField1) isMessage1_Oneof1A() {}
func (m *Message1) GetOneof1A() isMessage1_Oneof1A { func (m *Message1) GetOneof1A() isMessage1_Oneof1A {
if m != nil { if m != nil {
return m.Oneof1A return m.Oneof1A
@ -91,6 +81,16 @@ func (*Message1) XXX_OneofWrappers() []interface{} {
} }
} }
type isMessage1_Oneof1A interface {
isMessage1_Oneof1A()
}
type Message1_Oneof1AField1 struct {
Oneof1AField1 string `protobuf:"bytes,2,opt,name=Oneof1AField1,oneof"`
}
func (*Message1_Oneof1AField1) isMessage1_Oneof1A() {}
// COMMENT: Message2 // COMMENT: Message2
type Message2 struct { type Message2 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`

View File

@ -179,16 +179,6 @@ func (x *Message) GetName_() string {
return "" return ""
} }
type isMessage_OneofConflictA_ interface {
isMessage_OneofConflictA_()
}
type Message_OneofConflictA struct {
OneofConflictA string `protobuf:"bytes,40,opt,name=OneofConflictA,oneof"`
}
func (*Message_OneofConflictA) isMessage_OneofConflictA_() {}
func (m *Message) GetOneofConflictA_() isMessage_OneofConflictA_ { func (m *Message) GetOneofConflictA_() isMessage_OneofConflictA_ {
if m != nil { if m != nil {
return m.OneofConflictA_ return m.OneofConflictA_
@ -203,22 +193,6 @@ func (x *Message) GetOneofConflictA() string {
return "" return ""
} }
type isMessage_OneofConflictB interface {
isMessage_OneofConflictB()
}
type Message_OneofNoConflict struct {
OneofNoConflict string `protobuf:"bytes,50,opt,name=oneof_no_conflict,json=oneofNoConflict,oneof"`
}
type Message_OneofConflictB_ struct {
OneofConflictB_ string `protobuf:"bytes,51,opt,name=OneofConflictB,oneof"`
}
func (*Message_OneofNoConflict) isMessage_OneofConflictB() {}
func (*Message_OneofConflictB_) isMessage_OneofConflictB() {}
func (m *Message) GetOneofConflictB() isMessage_OneofConflictB { func (m *Message) GetOneofConflictB() isMessage_OneofConflictB {
if m != nil { if m != nil {
return m.OneofConflictB return m.OneofConflictB
@ -240,16 +214,6 @@ func (x *Message) GetOneofConflictB_() string {
return "" return ""
} }
type isMessage_OneofConflictC interface {
isMessage_OneofConflictC()
}
type Message_OneofMessageConflict_ struct {
OneofMessageConflict string `protobuf:"bytes,60,opt,name=oneof_message_conflict,json=oneofMessageConflict,oneof"`
}
func (*Message_OneofMessageConflict_) isMessage_OneofConflictC() {}
func (m *Message) GetOneofConflictC() isMessage_OneofConflictC { func (m *Message) GetOneofConflictC() isMessage_OneofConflictC {
if m != nil { if m != nil {
return m.OneofConflictC return m.OneofConflictC
@ -274,6 +238,42 @@ func (*Message) XXX_OneofWrappers() []interface{} {
} }
} }
type isMessage_OneofConflictA_ interface {
isMessage_OneofConflictA_()
}
type Message_OneofConflictA struct {
OneofConflictA string `protobuf:"bytes,40,opt,name=OneofConflictA,oneof"`
}
func (*Message_OneofConflictA) isMessage_OneofConflictA_() {}
type isMessage_OneofConflictB interface {
isMessage_OneofConflictB()
}
type Message_OneofNoConflict struct {
OneofNoConflict string `protobuf:"bytes,50,opt,name=oneof_no_conflict,json=oneofNoConflict,oneof"`
}
type Message_OneofConflictB_ struct {
OneofConflictB_ string `protobuf:"bytes,51,opt,name=OneofConflictB,oneof"`
}
func (*Message_OneofNoConflict) isMessage_OneofConflictB() {}
func (*Message_OneofConflictB_) isMessage_OneofConflictB() {}
type isMessage_OneofConflictC interface {
isMessage_OneofConflictC()
}
type Message_OneofMessageConflict_ struct {
OneofMessageConflict string `protobuf:"bytes,60,opt,name=oneof_message_conflict,json=oneofMessageConflict,oneof"`
}
func (*Message_OneofMessageConflict_) isMessage_OneofConflictC() {}
type Message_OneofMessageConflict struct { type Message_OneofMessageConflict struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`

View File

@ -241,22 +241,6 @@ func (x *M) GetF() float64 {
return Default_M_F return Default_M_F
} }
type isM_OneofField interface {
isM_OneofField()
}
type M_OneofInt32 struct {
OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,oneof"`
}
type M_OneofInt64 struct {
OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,oneof"`
}
func (*M_OneofInt32) isM_OneofField() {}
func (*M_OneofInt64) isM_OneofField() {}
func (m *M) GetOneofField() isM_OneofField { func (m *M) GetOneofField() isM_OneofField {
if m != nil { if m != nil {
return m.OneofField return m.OneofField
@ -286,6 +270,22 @@ func (*M) XXX_OneofWrappers() []interface{} {
} }
} }
type isM_OneofField interface {
isM_OneofField()
}
type M_OneofInt32 struct {
OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,oneof"`
}
type M_OneofInt64 struct {
OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,oneof"`
}
func (*M_OneofInt32) isM_OneofField() {}
func (*M_OneofInt64) isM_OneofField() {}
type M_Submessage struct { type M_Submessage struct {
// Types that are valid to be assigned to SubmessageOneofField: // Types that are valid to be assigned to SubmessageOneofField:
// *M_Submessage_SubmessageOneofInt32 // *M_Submessage_SubmessageOneofInt32
@ -319,22 +319,6 @@ func (*M_Submessage) Descriptor() ([]byte, []int) {
return xxx_File_import_public_sub_a_proto_rawDescGZIP(), []int{0, 0} return xxx_File_import_public_sub_a_proto_rawDescGZIP(), []int{0, 0}
} }
type isM_Submessage_SubmessageOneofField interface {
isM_Submessage_SubmessageOneofField()
}
type M_Submessage_SubmessageOneofInt32 struct {
SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,oneof"`
}
type M_Submessage_SubmessageOneofInt64 struct {
SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,oneof"`
}
func (*M_Submessage_SubmessageOneofInt32) isM_Submessage_SubmessageOneofField() {}
func (*M_Submessage_SubmessageOneofInt64) isM_Submessage_SubmessageOneofField() {}
func (m *M_Submessage) GetSubmessageOneofField() isM_Submessage_SubmessageOneofField { func (m *M_Submessage) GetSubmessageOneofField() isM_Submessage_SubmessageOneofField {
if m != nil { if m != nil {
return m.SubmessageOneofField return m.SubmessageOneofField
@ -364,6 +348,22 @@ func (*M_Submessage) XXX_OneofWrappers() []interface{} {
} }
} }
type isM_Submessage_SubmessageOneofField interface {
isM_Submessage_SubmessageOneofField()
}
type M_Submessage_SubmessageOneofInt32 struct {
SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,oneof"`
}
type M_Submessage_SubmessageOneofInt64 struct {
SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,oneof"`
}
func (*M_Submessage_SubmessageOneofInt32) isM_Submessage_SubmessageOneofField() {}
func (*M_Submessage_SubmessageOneofInt64) isM_Submessage_SubmessageOneofField() {}
var xxx_File_import_public_sub_a_proto_extDescs = []protoiface.ExtensionDescV1{ var xxx_File_import_public_sub_a_proto_extDescs = []protoiface.ExtensionDescV1{
{ {
ExtendedType: (*M)(nil), ExtendedType: (*M)(nil),

View File

@ -45,16 +45,6 @@ func (*Foo) Descriptor() ([]byte, []int) {
return xxx_File_issue780_oneof_conflict_test_proto_rawDescGZIP(), []int{0} return xxx_File_issue780_oneof_conflict_test_proto_rawDescGZIP(), []int{0}
} }
type isFoo_Bar interface {
isFoo_Bar()
}
type Foo_GetBar struct {
GetBar string `protobuf:"bytes,1,opt,name=get_bar,json=getBar,oneof"`
}
func (*Foo_GetBar) isFoo_Bar() {}
func (m *Foo) GetBar() isFoo_Bar { func (m *Foo) GetBar() isFoo_Bar {
if m != nil { if m != nil {
return m.Bar return m.Bar
@ -76,6 +66,16 @@ func (*Foo) XXX_OneofWrappers() []interface{} {
} }
} }
type isFoo_Bar interface {
isFoo_Bar()
}
type Foo_GetBar struct {
GetBar string `protobuf:"bytes,1,opt,name=get_bar,json=getBar,oneof"`
}
func (*Foo_GetBar) isFoo_Bar() {}
var File_issue780_oneof_conflict_test_proto protoreflect.FileDescriptor var File_issue780_oneof_conflict_test_proto protoreflect.FileDescriptor
var xxx_File_issue780_oneof_conflict_test_proto_rawDesc = []byte{ var xxx_File_issue780_oneof_conflict_test_proto_rawDesc = []byte{

View File

@ -794,124 +794,6 @@ func (x *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum
return nil return nil
} }
type isFieldTestMessage_OneofField interface {
isFieldTestMessage_OneofField()
}
type FieldTestMessage_OneofBool struct {
OneofBool bool `protobuf:"varint,601,opt,name=oneof_bool,json=oneofBool,oneof"`
}
type FieldTestMessage_OneofEnum struct {
OneofEnum FieldTestMessage_Enum `protobuf:"varint,602,opt,name=oneof_enum,json=oneofEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum,oneof"`
}
type FieldTestMessage_OneofInt32 struct {
OneofInt32 int32 `protobuf:"varint,603,opt,name=oneof_int32,json=oneofInt32,oneof"`
}
type FieldTestMessage_OneofSint32 struct {
OneofSint32 int32 `protobuf:"zigzag32,604,opt,name=oneof_sint32,json=oneofSint32,oneof"`
}
type FieldTestMessage_OneofUint32 struct {
OneofUint32 uint32 `protobuf:"varint,605,opt,name=oneof_uint32,json=oneofUint32,oneof"`
}
type FieldTestMessage_OneofInt64 struct {
OneofInt64 int64 `protobuf:"varint,606,opt,name=oneof_int64,json=oneofInt64,oneof"`
}
type FieldTestMessage_OneofSint64 struct {
OneofSint64 int64 `protobuf:"zigzag64,607,opt,name=oneof_sint64,json=oneofSint64,oneof"`
}
type FieldTestMessage_OneofUint64 struct {
OneofUint64 uint64 `protobuf:"varint,608,opt,name=oneof_uint64,json=oneofUint64,oneof"`
}
type FieldTestMessage_OneofSfixed32 struct {
OneofSfixed32 int32 `protobuf:"fixed32,609,opt,name=oneof_sfixed32,json=oneofSfixed32,oneof"`
}
type FieldTestMessage_OneofFixed32 struct {
OneofFixed32 uint32 `protobuf:"fixed32,610,opt,name=oneof_fixed32,json=oneofFixed32,oneof"`
}
type FieldTestMessage_OneofFloat struct {
OneofFloat float32 `protobuf:"fixed32,611,opt,name=oneof_float,json=oneofFloat,oneof"`
}
type FieldTestMessage_OneofSfixed64 struct {
OneofSfixed64 int64 `protobuf:"fixed64,612,opt,name=oneof_sfixed64,json=oneofSfixed64,oneof"`
}
type FieldTestMessage_OneofFixed64 struct {
OneofFixed64 uint64 `protobuf:"fixed64,613,opt,name=oneof_fixed64,json=oneofFixed64,oneof"`
}
type FieldTestMessage_OneofDouble struct {
OneofDouble float64 `protobuf:"fixed64,614,opt,name=oneof_double,json=oneofDouble,oneof"`
}
type FieldTestMessage_OneofString struct {
OneofString string `protobuf:"bytes,615,opt,name=oneof_string,json=oneofString,oneof"`
}
type FieldTestMessage_OneofBytes struct {
OneofBytes []byte `protobuf:"bytes,616,opt,name=oneof_bytes,json=oneofBytes,oneof"`
}
type FieldTestMessage_Oneof_Message struct {
Oneof_Message *FieldTestMessage_Message `protobuf:"bytes,617,opt,name=oneof_Message,json=oneofMessage,oneof"`
}
type FieldTestMessage_Oneofgroup struct {
Oneofgroup *FieldTestMessage_OneofGroup `protobuf:"group,618,opt,name=OneofGroup,json=oneofgroup,oneof"`
}
type FieldTestMessage_OneofLargestTag struct {
OneofLargestTag int32 `protobuf:"varint,536870911,opt,name=oneof_largest_tag,json=oneofLargestTag,oneof"`
}
func (*FieldTestMessage_OneofBool) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofEnum) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofInt32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSint32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofUint32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofInt64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSint64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofUint64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSfixed32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofFixed32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofFloat) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSfixed64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofFixed64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofDouble) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofString) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofBytes) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_Oneof_Message) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_Oneofgroup) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofLargestTag) isFieldTestMessage_OneofField() {}
func (m *FieldTestMessage) GetOneofField() isFieldTestMessage_OneofField { func (m *FieldTestMessage) GetOneofField() isFieldTestMessage_OneofField {
if m != nil { if m != nil {
return m.OneofField return m.OneofField
@ -1052,22 +934,6 @@ func (x *FieldTestMessage) GetOneofLargestTag() int32 {
return 0 return 0
} }
type isFieldTestMessage_OneofTwo interface {
isFieldTestMessage_OneofTwo()
}
type FieldTestMessage_OneofTwo_1 struct {
OneofTwo_1 int32 `protobuf:"varint,700,opt,name=oneof_two_1,json=oneofTwo1,oneof"`
}
type FieldTestMessage_OneofTwo_2 struct {
OneofTwo_2 int64 `protobuf:"varint,701,opt,name=oneof_two_2,json=oneofTwo2,oneof"`
}
func (*FieldTestMessage_OneofTwo_1) isFieldTestMessage_OneofTwo() {}
func (*FieldTestMessage_OneofTwo_2) isFieldTestMessage_OneofTwo() {}
func (m *FieldTestMessage) GetOneofTwo() isFieldTestMessage_OneofTwo { func (m *FieldTestMessage) GetOneofTwo() isFieldTestMessage_OneofTwo {
if m != nil { if m != nil {
return m.OneofTwo return m.OneofTwo
@ -1116,6 +982,140 @@ func (*FieldTestMessage) XXX_OneofWrappers() []interface{} {
} }
} }
type isFieldTestMessage_OneofField interface {
isFieldTestMessage_OneofField()
}
type FieldTestMessage_OneofBool struct {
OneofBool bool `protobuf:"varint,601,opt,name=oneof_bool,json=oneofBool,oneof"`
}
type FieldTestMessage_OneofEnum struct {
OneofEnum FieldTestMessage_Enum `protobuf:"varint,602,opt,name=oneof_enum,json=oneofEnum,enum=goproto.protoc.proto2.FieldTestMessage_Enum,oneof"`
}
type FieldTestMessage_OneofInt32 struct {
OneofInt32 int32 `protobuf:"varint,603,opt,name=oneof_int32,json=oneofInt32,oneof"`
}
type FieldTestMessage_OneofSint32 struct {
OneofSint32 int32 `protobuf:"zigzag32,604,opt,name=oneof_sint32,json=oneofSint32,oneof"`
}
type FieldTestMessage_OneofUint32 struct {
OneofUint32 uint32 `protobuf:"varint,605,opt,name=oneof_uint32,json=oneofUint32,oneof"`
}
type FieldTestMessage_OneofInt64 struct {
OneofInt64 int64 `protobuf:"varint,606,opt,name=oneof_int64,json=oneofInt64,oneof"`
}
type FieldTestMessage_OneofSint64 struct {
OneofSint64 int64 `protobuf:"zigzag64,607,opt,name=oneof_sint64,json=oneofSint64,oneof"`
}
type FieldTestMessage_OneofUint64 struct {
OneofUint64 uint64 `protobuf:"varint,608,opt,name=oneof_uint64,json=oneofUint64,oneof"`
}
type FieldTestMessage_OneofSfixed32 struct {
OneofSfixed32 int32 `protobuf:"fixed32,609,opt,name=oneof_sfixed32,json=oneofSfixed32,oneof"`
}
type FieldTestMessage_OneofFixed32 struct {
OneofFixed32 uint32 `protobuf:"fixed32,610,opt,name=oneof_fixed32,json=oneofFixed32,oneof"`
}
type FieldTestMessage_OneofFloat struct {
OneofFloat float32 `protobuf:"fixed32,611,opt,name=oneof_float,json=oneofFloat,oneof"`
}
type FieldTestMessage_OneofSfixed64 struct {
OneofSfixed64 int64 `protobuf:"fixed64,612,opt,name=oneof_sfixed64,json=oneofSfixed64,oneof"`
}
type FieldTestMessage_OneofFixed64 struct {
OneofFixed64 uint64 `protobuf:"fixed64,613,opt,name=oneof_fixed64,json=oneofFixed64,oneof"`
}
type FieldTestMessage_OneofDouble struct {
OneofDouble float64 `protobuf:"fixed64,614,opt,name=oneof_double,json=oneofDouble,oneof"`
}
type FieldTestMessage_OneofString struct {
OneofString string `protobuf:"bytes,615,opt,name=oneof_string,json=oneofString,oneof"`
}
type FieldTestMessage_OneofBytes struct {
OneofBytes []byte `protobuf:"bytes,616,opt,name=oneof_bytes,json=oneofBytes,oneof"`
}
type FieldTestMessage_Oneof_Message struct {
Oneof_Message *FieldTestMessage_Message `protobuf:"bytes,617,opt,name=oneof_Message,json=oneofMessage,oneof"`
}
type FieldTestMessage_Oneofgroup struct {
Oneofgroup *FieldTestMessage_OneofGroup `protobuf:"group,618,opt,name=OneofGroup,json=oneofgroup,oneof"`
}
type FieldTestMessage_OneofLargestTag struct {
OneofLargestTag int32 `protobuf:"varint,536870911,opt,name=oneof_largest_tag,json=oneofLargestTag,oneof"`
}
func (*FieldTestMessage_OneofBool) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofEnum) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofInt32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSint32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofUint32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofInt64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSint64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofUint64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSfixed32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofFixed32) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofFloat) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofSfixed64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofFixed64) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofDouble) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofString) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofBytes) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_Oneof_Message) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_Oneofgroup) isFieldTestMessage_OneofField() {}
func (*FieldTestMessage_OneofLargestTag) isFieldTestMessage_OneofField() {}
type isFieldTestMessage_OneofTwo interface {
isFieldTestMessage_OneofTwo()
}
type FieldTestMessage_OneofTwo_1 struct {
OneofTwo_1 int32 `protobuf:"varint,700,opt,name=oneof_two_1,json=oneofTwo1,oneof"`
}
type FieldTestMessage_OneofTwo_2 struct {
OneofTwo_2 int64 `protobuf:"varint,701,opt,name=oneof_two_2,json=oneofTwo2,oneof"`
}
func (*FieldTestMessage_OneofTwo_1) isFieldTestMessage_OneofTwo() {}
func (*FieldTestMessage_OneofTwo_2) isFieldTestMessage_OneofTwo() {}
type FieldTestMessage_OptionalGroup struct { type FieldTestMessage_OptionalGroup struct {
OptionalGroup *string `protobuf:"bytes,19,opt,name=optional_group,json=optionalGroup" json:"optional_group,omitempty"` OptionalGroup *string `protobuf:"bytes,19,opt,name=optional_group,json=optionalGroup" json:"optional_group,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`

View File

@ -759,16 +759,6 @@ func (x *IndirectRequired) GetStrToNested() map[string]*NestedWithRequired {
return nil return nil
} }
type isIndirectRequired_Union interface {
isIndirectRequired_Union()
}
type IndirectRequired_OneofNested struct {
OneofNested *NestedWithRequired `protobuf:"bytes,4,opt,name=oneof_nested,json=oneofNested,oneof"`
}
func (*IndirectRequired_OneofNested) isIndirectRequired_Union() {}
func (m *IndirectRequired) GetUnion() isIndirectRequired_Union { func (m *IndirectRequired) GetUnion() isIndirectRequired_Union {
if m != nil { if m != nil {
return m.Union return m.Union
@ -790,6 +780,16 @@ func (*IndirectRequired) XXX_OneofWrappers() []interface{} {
} }
} }
type isIndirectRequired_Union interface {
isIndirectRequired_Union()
}
type IndirectRequired_OneofNested struct {
OneofNested *NestedWithRequired `protobuf:"bytes,4,opt,name=oneof_nested,json=oneofNested,oneof"`
}
func (*IndirectRequired_OneofNested) isIndirectRequired_Union() {}
type Extensions struct { type Extensions struct {
OptString *string `protobuf:"bytes,1,opt,name=opt_string,json=optString" json:"opt_string,omitempty"` OptString *string `protobuf:"bytes,1,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
OptBool *bool `protobuf:"varint,101,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"` OptBool *bool `protobuf:"varint,101,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`

View File

@ -412,28 +412,6 @@ func (*Oneofs) Descriptor() ([]byte, []int) {
return xxx_File_pb3_test_proto_rawDescGZIP(), []int{4} return xxx_File_pb3_test_proto_rawDescGZIP(), []int{4}
} }
type isOneofs_Union interface {
isOneofs_Union()
}
type Oneofs_OneofEnum struct {
OneofEnum Enum `protobuf:"varint,1,opt,name=oneof_enum,json=oneofEnum,proto3,enum=pb3.Enum,oneof"`
}
type Oneofs_OneofString struct {
OneofString string `protobuf:"bytes,2,opt,name=oneof_string,json=oneofString,proto3,oneof"`
}
type Oneofs_OneofNested struct {
OneofNested *Nested `protobuf:"bytes,3,opt,name=oneof_nested,json=oneofNested,proto3,oneof"`
}
func (*Oneofs_OneofEnum) isOneofs_Union() {}
func (*Oneofs_OneofString) isOneofs_Union() {}
func (*Oneofs_OneofNested) isOneofs_Union() {}
func (m *Oneofs) GetUnion() isOneofs_Union { func (m *Oneofs) GetUnion() isOneofs_Union {
if m != nil { if m != nil {
return m.Union return m.Union
@ -471,6 +449,28 @@ func (*Oneofs) XXX_OneofWrappers() []interface{} {
} }
} }
type isOneofs_Union interface {
isOneofs_Union()
}
type Oneofs_OneofEnum struct {
OneofEnum Enum `protobuf:"varint,1,opt,name=oneof_enum,json=oneofEnum,proto3,enum=pb3.Enum,oneof"`
}
type Oneofs_OneofString struct {
OneofString string `protobuf:"bytes,2,opt,name=oneof_string,json=oneofString,proto3,oneof"`
}
type Oneofs_OneofNested struct {
OneofNested *Nested `protobuf:"bytes,3,opt,name=oneof_nested,json=oneofNested,proto3,oneof"`
}
func (*Oneofs_OneofEnum) isOneofs_Union() {}
func (*Oneofs_OneofString) isOneofs_Union() {}
func (*Oneofs_OneofNested) isOneofs_Union() {}
// Message contains map fields. // Message contains map fields.
type Maps struct { type Maps struct {
Int32ToStr map[int32]string `protobuf:"bytes,1,rep,name=int32_to_str,json=int32ToStr,proto3" json:"int32_to_str,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Int32ToStr map[int32]string `protobuf:"bytes,1,rep,name=int32_to_str,json=int32ToStr,proto3" json:"int32_to_str,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`

View File

@ -215,34 +215,6 @@ func (*ConformanceRequest) Descriptor() ([]byte, []int) {
return xxx_File_conformance_conformance_proto_rawDescGZIP(), []int{1} return xxx_File_conformance_conformance_proto_rawDescGZIP(), []int{1}
} }
type isConformanceRequest_Payload interface {
isConformanceRequest_Payload()
}
type ConformanceRequest_ProtobufPayload struct {
ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
}
type ConformanceRequest_JsonPayload struct {
JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
}
type ConformanceRequest_JspbPayload struct {
JspbPayload string `protobuf:"bytes,7,opt,name=jspb_payload,json=jspbPayload,proto3,oneof"`
}
type ConformanceRequest_TextPayload struct {
TextPayload string `protobuf:"bytes,8,opt,name=text_payload,json=textPayload,proto3,oneof"`
}
func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {}
func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload() {}
func (*ConformanceRequest_JspbPayload) isConformanceRequest_Payload() {}
func (*ConformanceRequest_TextPayload) isConformanceRequest_Payload() {}
func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload { func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload {
if m != nil { if m != nil {
return m.Payload return m.Payload
@ -316,6 +288,34 @@ func (*ConformanceRequest) XXX_OneofWrappers() []interface{} {
} }
} }
type isConformanceRequest_Payload interface {
isConformanceRequest_Payload()
}
type ConformanceRequest_ProtobufPayload struct {
ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
}
type ConformanceRequest_JsonPayload struct {
JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
}
type ConformanceRequest_JspbPayload struct {
JspbPayload string `protobuf:"bytes,7,opt,name=jspb_payload,json=jspbPayload,proto3,oneof"`
}
type ConformanceRequest_TextPayload struct {
TextPayload string `protobuf:"bytes,8,opt,name=text_payload,json=textPayload,proto3,oneof"`
}
func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {}
func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload() {}
func (*ConformanceRequest_JspbPayload) isConformanceRequest_Payload() {}
func (*ConformanceRequest_TextPayload) isConformanceRequest_Payload() {}
// Represents a single test case's output. // Represents a single test case's output.
type ConformanceResponse struct { type ConformanceResponse struct {
// Types that are valid to be assigned to Result: // Types that are valid to be assigned to Result:
@ -378,58 +378,6 @@ func (*ConformanceResponse) Descriptor() ([]byte, []int) {
return xxx_File_conformance_conformance_proto_rawDescGZIP(), []int{2} return xxx_File_conformance_conformance_proto_rawDescGZIP(), []int{2}
} }
type isConformanceResponse_Result interface {
isConformanceResponse_Result()
}
type ConformanceResponse_ParseError struct {
ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"`
}
type ConformanceResponse_SerializeError struct {
SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"`
}
type ConformanceResponse_RuntimeError struct {
RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"`
}
type ConformanceResponse_ProtobufPayload struct {
ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
}
type ConformanceResponse_JsonPayload struct {
JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
}
type ConformanceResponse_Skipped struct {
Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"`
}
type ConformanceResponse_JspbPayload struct {
JspbPayload string `protobuf:"bytes,7,opt,name=jspb_payload,json=jspbPayload,proto3,oneof"`
}
type ConformanceResponse_TextPayload struct {
TextPayload string `protobuf:"bytes,8,opt,name=text_payload,json=textPayload,proto3,oneof"`
}
func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {}
func (*ConformanceResponse_SerializeError) isConformanceResponse_Result() {}
func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result() {}
func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {}
func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result() {}
func (*ConformanceResponse_Skipped) isConformanceResponse_Result() {}
func (*ConformanceResponse_JspbPayload) isConformanceResponse_Result() {}
func (*ConformanceResponse_TextPayload) isConformanceResponse_Result() {}
func (m *ConformanceResponse) GetResult() isConformanceResponse_Result { func (m *ConformanceResponse) GetResult() isConformanceResponse_Result {
if m != nil { if m != nil {
return m.Result return m.Result
@ -507,6 +455,58 @@ func (*ConformanceResponse) XXX_OneofWrappers() []interface{} {
} }
} }
type isConformanceResponse_Result interface {
isConformanceResponse_Result()
}
type ConformanceResponse_ParseError struct {
ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"`
}
type ConformanceResponse_SerializeError struct {
SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"`
}
type ConformanceResponse_RuntimeError struct {
RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"`
}
type ConformanceResponse_ProtobufPayload struct {
ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
}
type ConformanceResponse_JsonPayload struct {
JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
}
type ConformanceResponse_Skipped struct {
Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"`
}
type ConformanceResponse_JspbPayload struct {
JspbPayload string `protobuf:"bytes,7,opt,name=jspb_payload,json=jspbPayload,proto3,oneof"`
}
type ConformanceResponse_TextPayload struct {
TextPayload string `protobuf:"bytes,8,opt,name=text_payload,json=textPayload,proto3,oneof"`
}
func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {}
func (*ConformanceResponse_SerializeError) isConformanceResponse_Result() {}
func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result() {}
func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {}
func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result() {}
func (*ConformanceResponse_Skipped) isConformanceResponse_Result() {}
func (*ConformanceResponse_JspbPayload) isConformanceResponse_Result() {}
func (*ConformanceResponse_TextPayload) isConformanceResponse_Result() {}
// Encoding options for jspb format. // Encoding options for jspb format.
type JspbEncodingConfig struct { type JspbEncodingConfig struct {
// Encode the value field of Any as jspb array if ture, otherwise binary. // Encode the value field of Any as jspb array if ture, otherwise binary.

View File

@ -900,64 +900,6 @@ func (x *TestAllTypes) GetDefaultForeignEnum() ForeignEnum {
return Default_TestAllTypes_DefaultForeignEnum return Default_TestAllTypes_DefaultForeignEnum
} }
type isTestAllTypes_OneofField interface {
isTestAllTypes_OneofField()
}
type TestAllTypes_OneofUint32 struct {
OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,oneof"`
}
type TestAllTypes_OneofNestedMessage struct {
OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof"`
}
type TestAllTypes_OneofString struct {
OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,oneof"`
}
type TestAllTypes_OneofBytes struct {
OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,oneof"`
}
type TestAllTypes_OneofBool struct {
OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,oneof"`
}
type TestAllTypes_OneofUint64 struct {
OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,oneof"`
}
type TestAllTypes_OneofFloat struct {
OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,oneof"`
}
type TestAllTypes_OneofDouble struct {
OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,oneof"`
}
type TestAllTypes_OneofEnum struct {
OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,enum=goproto.proto.test.TestAllTypes_NestedEnum,oneof"`
}
func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {}
func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField { func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {
if m != nil { if m != nil {
return m.OneofField return m.OneofField
@ -1043,6 +985,64 @@ func (*TestAllTypes) XXX_OneofWrappers() []interface{} {
} }
} }
type isTestAllTypes_OneofField interface {
isTestAllTypes_OneofField()
}
type TestAllTypes_OneofUint32 struct {
OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,oneof"`
}
type TestAllTypes_OneofNestedMessage struct {
OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof"`
}
type TestAllTypes_OneofString struct {
OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,oneof"`
}
type TestAllTypes_OneofBytes struct {
OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,oneof"`
}
type TestAllTypes_OneofBool struct {
OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,oneof"`
}
type TestAllTypes_OneofUint64 struct {
OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,oneof"`
}
type TestAllTypes_OneofFloat struct {
OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,oneof"`
}
type TestAllTypes_OneofDouble struct {
OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,oneof"`
}
type TestAllTypes_OneofEnum struct {
OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,enum=goproto.proto.test.TestAllTypes_NestedEnum,oneof"`
}
func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {}
// Deprecated: Do not use. // Deprecated: Do not use.
type TestDeprecatedMessage struct { type TestDeprecatedMessage struct {
DeprecatedInt32 *int32 `protobuf:"varint,1,opt,name=deprecated_int32,json=deprecatedInt32" json:"deprecated_int32,omitempty"` // Deprecated: Do not use. DeprecatedInt32 *int32 `protobuf:"varint,1,opt,name=deprecated_int32,json=deprecatedInt32" json:"deprecated_int32,omitempty"` // Deprecated: Do not use.
@ -1085,16 +1085,6 @@ func (x *TestDeprecatedMessage) GetDeprecatedInt32() int32 {
return 0 return 0
} }
type isTestDeprecatedMessage_DeprecatedOneof interface {
isTestDeprecatedMessage_DeprecatedOneof()
}
type TestDeprecatedMessage_DeprecatedOneofField struct {
DeprecatedOneofField int32 `protobuf:"varint,2,opt,name=deprecated_oneof_field,json=deprecatedOneofField,oneof"`
}
func (*TestDeprecatedMessage_DeprecatedOneofField) isTestDeprecatedMessage_DeprecatedOneof() {}
func (m *TestDeprecatedMessage) GetDeprecatedOneof() isTestDeprecatedMessage_DeprecatedOneof { func (m *TestDeprecatedMessage) GetDeprecatedOneof() isTestDeprecatedMessage_DeprecatedOneof {
if m != nil { if m != nil {
return m.DeprecatedOneof return m.DeprecatedOneof
@ -1117,6 +1107,16 @@ func (*TestDeprecatedMessage) XXX_OneofWrappers() []interface{} {
} }
} }
type isTestDeprecatedMessage_DeprecatedOneof interface {
isTestDeprecatedMessage_DeprecatedOneof()
}
type TestDeprecatedMessage_DeprecatedOneofField struct {
DeprecatedOneofField int32 `protobuf:"varint,2,opt,name=deprecated_oneof_field,json=deprecatedOneofField,oneof"`
}
func (*TestDeprecatedMessage_DeprecatedOneofField) isTestDeprecatedMessage_DeprecatedOneof() {}
type ForeignMessage struct { type ForeignMessage struct {
C *int32 `protobuf:"varint,1,opt,name=c" json:"c,omitempty"` C *int32 `protobuf:"varint,1,opt,name=c" json:"c,omitempty"`
D *int32 `protobuf:"varint,2,opt,name=d" json:"d,omitempty"` D *int32 `protobuf:"varint,2,opt,name=d" json:"d,omitempty"`

View File

@ -609,64 +609,6 @@ func (x *TestAllTypes) GetMapStringNestedEnum() map[string]TestAllTypes_NestedEn
return nil return nil
} }
type isTestAllTypes_OneofField interface {
isTestAllTypes_OneofField()
}
type TestAllTypes_OneofUint32 struct {
OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"`
}
type TestAllTypes_OneofNestedMessage struct {
OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"`
}
type TestAllTypes_OneofString struct {
OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"`
}
type TestAllTypes_OneofBytes struct {
OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
}
type TestAllTypes_OneofBool struct {
OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"`
}
type TestAllTypes_OneofUint64 struct {
OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"`
}
type TestAllTypes_OneofFloat struct {
OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"`
}
type TestAllTypes_OneofDouble struct {
OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"`
}
type TestAllTypes_OneofEnum struct {
OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=goproto.proto.test3.TestAllTypes_NestedEnum,oneof"`
}
func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {}
func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField { func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {
if m != nil { if m != nil {
return m.OneofField return m.OneofField
@ -752,6 +694,64 @@ func (*TestAllTypes) XXX_OneofWrappers() []interface{} {
} }
} }
type isTestAllTypes_OneofField interface {
isTestAllTypes_OneofField()
}
type TestAllTypes_OneofUint32 struct {
OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"`
}
type TestAllTypes_OneofNestedMessage struct {
OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"`
}
type TestAllTypes_OneofString struct {
OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"`
}
type TestAllTypes_OneofBytes struct {
OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
}
type TestAllTypes_OneofBool struct {
OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"`
}
type TestAllTypes_OneofUint64 struct {
OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"`
}
type TestAllTypes_OneofFloat struct {
OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"`
}
type TestAllTypes_OneofDouble struct {
OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"`
}
type TestAllTypes_OneofEnum struct {
OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=goproto.proto.test3.TestAllTypes_NestedEnum,oneof"`
}
func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {}
func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {}
type ForeignMessage struct { type ForeignMessage struct {
C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"` C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"`
D int32 `protobuf:"varint,2,opt,name=d,proto3" json:"d,omitempty"` D int32 `protobuf:"varint,2,opt,name=d,proto3" json:"d,omitempty"`

View File

@ -154,46 +154,6 @@ func (*Value) Descriptor() ([]byte, []int) {
func (*Value) XXX_WellKnownType() string { return "Value" } func (*Value) XXX_WellKnownType() string { return "Value" }
type isValue_Kind interface {
isValue_Kind()
}
type Value_NullValue struct {
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
}
type Value_NumberValue struct {
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
}
type Value_StringValue struct {
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
}
type Value_BoolValue struct {
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type Value_StructValue struct {
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
}
type Value_ListValue struct {
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"`
}
func (*Value_NullValue) isValue_Kind() {}
func (*Value_NumberValue) isValue_Kind() {}
func (*Value_StringValue) isValue_Kind() {}
func (*Value_BoolValue) isValue_Kind() {}
func (*Value_StructValue) isValue_Kind() {}
func (*Value_ListValue) isValue_Kind() {}
func (m *Value) GetKind() isValue_Kind { func (m *Value) GetKind() isValue_Kind {
if m != nil { if m != nil {
return m.Kind return m.Kind
@ -255,6 +215,46 @@ func (*Value) XXX_OneofWrappers() []interface{} {
} }
} }
type isValue_Kind interface {
isValue_Kind()
}
type Value_NullValue struct {
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
}
type Value_NumberValue struct {
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
}
type Value_StringValue struct {
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
}
type Value_BoolValue struct {
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
}
type Value_StructValue struct {
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
}
type Value_ListValue struct {
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"`
}
func (*Value_NullValue) isValue_Kind() {}
func (*Value_NumberValue) isValue_Kind() {}
func (*Value_StringValue) isValue_Kind() {}
func (*Value_BoolValue) isValue_Kind() {}
func (*Value_StructValue) isValue_Kind() {}
func (*Value_ListValue) isValue_Kind() {}
// `ListValue` is a wrapper around a repeated field of values. // `ListValue` is a wrapper around a repeated field of values.
// //
// The JSON representation for `ListValue` is JSON array. // The JSON representation for `ListValue` is JSON array.