diff --git a/conformance/internal/conformance_proto/conformance.pb.go b/conformance/internal/conformance_proto/conformance.pb.go index 7c7804823d..215e00863c 100644 --- a/conformance/internal/conformance_proto/conformance.pb.go +++ b/conformance/internal/conformance_proto/conformance.pb.go @@ -157,10 +157,10 @@ type isConformanceRequest_Payload interface { } type ConformanceRequest_ProtobufPayload struct { - ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` + ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof" json:"protobuf_payload,omitempty"` } type ConformanceRequest_JsonPayload struct { - JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"` + JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof" json:"json_payload,omitempty"` } func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {} @@ -246,22 +246,22 @@ type isConformanceResponse_Result interface { } type ConformanceResponse_ParseError struct { - ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"` + ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof" json:"parse_error,omitempty"` } type ConformanceResponse_SerializeError struct { - SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"` + SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof" json:"serialize_error,omitempty"` } type ConformanceResponse_RuntimeError struct { - RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"` + RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof" json:"runtime_error,omitempty"` } type ConformanceResponse_ProtobufPayload struct { - ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"` + ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof" json:"protobuf_payload,omitempty"` } type ConformanceResponse_JsonPayload struct { - JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"` + JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof" json:"json_payload,omitempty"` } type ConformanceResponse_Skipped struct { - Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"` + Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof" json:"skipped,omitempty"` } func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {} @@ -484,16 +484,16 @@ type isTestAllTypes_OneofField interface { } type TestAllTypes_OneofUint32 struct { - OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"` + OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof" json:"oneof_uint32,omitempty"` } type TestAllTypes_OneofNestedMessage struct { - OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"` + OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof" json:"oneof_nested_message,omitempty"` } type TestAllTypes_OneofString struct { - OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"` + OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof" json:"oneof_string,omitempty"` } type TestAllTypes_OneofBytes struct { - OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"` + OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof" json:"oneof_bytes,omitempty"` } func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {} diff --git a/jsonpb/jsonpb_test_proto/test_objects.pb.go b/jsonpb/jsonpb_test_proto/test_objects.pb.go index 409f95a5e3..b3fa9ede25 100644 --- a/jsonpb/jsonpb_test_proto/test_objects.pb.go +++ b/jsonpb/jsonpb_test_proto/test_objects.pb.go @@ -620,19 +620,19 @@ type isMsgWithOneof_Union interface { } type MsgWithOneof_Title struct { - Title string `protobuf:"bytes,1,opt,name=title,oneof"` + Title string `protobuf:"bytes,1,opt,name=title,oneof" json:"title,omitempty"` } type MsgWithOneof_Salary struct { - Salary int64 `protobuf:"varint,2,opt,name=salary,oneof"` + Salary int64 `protobuf:"varint,2,opt,name=salary,oneof" json:"salary,omitempty"` } type MsgWithOneof_Country struct { - Country string `protobuf:"bytes,3,opt,name=Country,oneof"` + Country string `protobuf:"bytes,3,opt,name=Country,oneof" json:"Country,omitempty"` } type MsgWithOneof_HomeAddress struct { - HomeAddress string `protobuf:"bytes,4,opt,name=home_address,json=homeAddress,oneof"` + HomeAddress string `protobuf:"bytes,4,opt,name=home_address,json=homeAddress,oneof" json:"home_address,omitempty"` } type MsgWithOneof_MsgWithRequired struct { - MsgWithRequired *MsgWithRequired `protobuf:"bytes,5,opt,name=msg_with_required,json=msgWithRequired,oneof"` + MsgWithRequired *MsgWithRequired `protobuf:"bytes,5,opt,name=msg_with_required,json=msgWithRequired,oneof" json:"msg_with_required,omitempty"` } func (*MsgWithOneof_Title) isMsgWithOneof_Union() {} diff --git a/proto/proto3_proto/proto3.pb.go b/proto/proto3_proto/proto3.pb.go index f2dc6f9580..3fbcc5de36 100644 --- a/proto/proto3_proto/proto3.pb.go +++ b/proto/proto3_proto/proto3.pb.go @@ -437,7 +437,7 @@ type isTestUTF8_Oneof interface { } type TestUTF8_Field struct { - Field string `protobuf:"bytes,3,opt,name=field,proto3,oneof"` + Field string `protobuf:"bytes,3,opt,name=field,proto3,oneof" json:"field,omitempty"` } func (*TestUTF8_Field) isTestUTF8_Oneof() {} diff --git a/proto/test_proto/test.pb.go b/proto/test_proto/test.pb.go index de2dc47d8c..b79fb09193 100644 --- a/proto/test_proto/test.pb.go +++ b/proto/test_proto/test.pb.go @@ -3111,58 +3111,58 @@ type isOneof_Tormato interface { } type Oneof_F_Bool struct { - F_Bool bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,oneof"` + F_Bool bool `protobuf:"varint,1,opt,name=F_Bool,json=FBool,oneof" json:"F_Bool,omitempty"` } type Oneof_F_Int32 struct { - F_Int32 int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,oneof"` + F_Int32 int32 `protobuf:"varint,2,opt,name=F_Int32,json=FInt32,oneof" json:"F_Int32,omitempty"` } type Oneof_F_Int64 struct { - F_Int64 int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,oneof"` + F_Int64 int64 `protobuf:"varint,3,opt,name=F_Int64,json=FInt64,oneof" json:"F_Int64,omitempty"` } type Oneof_F_Fixed32 struct { - F_Fixed32 uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof"` + F_Fixed32 uint32 `protobuf:"fixed32,4,opt,name=F_Fixed32,json=FFixed32,oneof" json:"F_Fixed32,omitempty"` } type Oneof_F_Fixed64 struct { - F_Fixed64 uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof"` + F_Fixed64 uint64 `protobuf:"fixed64,5,opt,name=F_Fixed64,json=FFixed64,oneof" json:"F_Fixed64,omitempty"` } type Oneof_F_Uint32 struct { - F_Uint32 uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,oneof"` + F_Uint32 uint32 `protobuf:"varint,6,opt,name=F_Uint32,json=FUint32,oneof" json:"F_Uint32,omitempty"` } type Oneof_F_Uint64 struct { - F_Uint64 uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,oneof"` + F_Uint64 uint64 `protobuf:"varint,7,opt,name=F_Uint64,json=FUint64,oneof" json:"F_Uint64,omitempty"` } type Oneof_F_Float struct { - F_Float float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,oneof"` + F_Float float32 `protobuf:"fixed32,8,opt,name=F_Float,json=FFloat,oneof" json:"F_Float,omitempty"` } type Oneof_F_Double struct { - F_Double float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,oneof"` + F_Double float64 `protobuf:"fixed64,9,opt,name=F_Double,json=FDouble,oneof" json:"F_Double,omitempty"` } type Oneof_F_String struct { - F_String string `protobuf:"bytes,10,opt,name=F_String,json=FString,oneof"` + F_String string `protobuf:"bytes,10,opt,name=F_String,json=FString,oneof" json:"F_String,omitempty"` } type Oneof_F_Bytes struct { - F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,oneof"` + F_Bytes []byte `protobuf:"bytes,11,opt,name=F_Bytes,json=FBytes,oneof" json:"F_Bytes,omitempty"` } type Oneof_F_Sint32 struct { - F_Sint32 int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof"` + F_Sint32 int32 `protobuf:"zigzag32,12,opt,name=F_Sint32,json=FSint32,oneof" json:"F_Sint32,omitempty"` } type Oneof_F_Sint64 struct { - F_Sint64 int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof"` + F_Sint64 int64 `protobuf:"zigzag64,13,opt,name=F_Sint64,json=FSint64,oneof" json:"F_Sint64,omitempty"` } type Oneof_F_Enum struct { - F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.MyMessage_Color,oneof"` + F_Enum MyMessage_Color `protobuf:"varint,14,opt,name=F_Enum,json=FEnum,enum=test_proto.MyMessage_Color,oneof" json:"F_Enum,omitempty"` } type Oneof_F_Message struct { - F_Message *GoTestField `protobuf:"bytes,15,opt,name=F_Message,json=FMessage,oneof"` + F_Message *GoTestField `protobuf:"bytes,15,opt,name=F_Message,json=FMessage,oneof" json:"F_Message,omitempty"` } type Oneof_FGroup struct { - FGroup *Oneof_F_Group `protobuf:"group,16,opt,name=F_Group,json=fGroup,oneof"` + FGroup *Oneof_F_Group `protobuf:"group,16,opt,name=F_Group,json=fGroup,oneof" json:"f_group,omitempty"` } type Oneof_F_Largest_Tag struct { - F_Largest_Tag int32 `protobuf:"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof"` + F_Largest_Tag int32 `protobuf:"varint,536870911,opt,name=F_Largest_Tag,json=FLargestTag,oneof" json:"F_Largest_Tag,omitempty"` } type Oneof_Value struct { - Value int32 `protobuf:"varint,100,opt,name=value,oneof"` + Value int32 `protobuf:"varint,100,opt,name=value,oneof" json:"value,omitempty"` } func (*Oneof_F_Bool) isOneof_Union() {} @@ -3431,22 +3431,22 @@ type isCommunique_Union interface { } type Communique_Number struct { - Number int32 `protobuf:"varint,5,opt,name=number,oneof"` + Number int32 `protobuf:"varint,5,opt,name=number,oneof" json:"number,omitempty"` } type Communique_Name struct { - Name string `protobuf:"bytes,6,opt,name=name,oneof"` + Name string `protobuf:"bytes,6,opt,name=name,oneof" json:"name,omitempty"` } type Communique_Data struct { - Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` + Data []byte `protobuf:"bytes,7,opt,name=data,oneof" json:"data,omitempty"` } type Communique_TempC struct { - TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` + TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof" json:"temp_c,omitempty"` } type Communique_Col struct { - Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=test_proto.MyMessage_Color,oneof"` + Col MyMessage_Color `protobuf:"varint,9,opt,name=col,enum=test_proto.MyMessage_Color,oneof" json:"col,omitempty"` } type Communique_Msg struct { - Msg *Strings `protobuf:"bytes,10,opt,name=msg,oneof"` + Msg *Strings `protobuf:"bytes,10,opt,name=msg,oneof" json:"msg,omitempty"` } func (*Communique_Number) isCommunique_Union() {} @@ -3566,7 +3566,7 @@ type isTestUTF8_Oneof interface { } type TestUTF8_Field struct { - Field string `protobuf:"bytes,3,opt,name=field,oneof"` + Field string `protobuf:"bytes,3,opt,name=field,oneof" json:"field,omitempty"` } func (*TestUTF8_Field) isTestUTF8_Oneof() {} diff --git a/protoc-gen-gogo/generator/generator.go b/protoc-gen-gogo/generator/generator.go index dd260f142c..ab07ed61ef 100644 --- a/protoc-gen-gogo/generator/generator.go +++ b/protoc-gen-gogo/generator/generator.go @@ -2581,10 +2581,8 @@ func (g *Generator) generateOneofDecls(mc *msgCtx, topLevelFields []topLevelFiel g.P() for _, of := range ofields { for i, sf := range of.subFields { - _, wiretype := g.GoType(mc.message, sf.protoField) - tag := "protobuf:" + g.goTag(mc.message, sf.protoField, wiretype) fieldFullPath := fmt.Sprintf("%s,%d,%d", mc.message.path, messageFieldPath, i) - g.P("type ", Annotate(mc.message.file, fieldFullPath, sf.oneofTypeName), " struct{ ", Annotate(mc.message.file, fieldFullPath, sf.goName), " ", sf.goType, " `", tag, "` }") + g.P("type ", Annotate(mc.message.file, fieldFullPath, sf.oneofTypeName), " struct{ ", Annotate(mc.message.file, fieldFullPath, sf.goName), " ", sf.goType, " `", sf.tags, "` }") if !gogoproto.IsStdType(sf.protoField) && !gogoproto.IsCustomType(sf.protoField) && !gogoproto.IsCastType(sf.protoField) { g.RecordTypeUse(sf.protoField.GetTypeName()) } @@ -2932,7 +2930,6 @@ func (g *Generator) generateMessage(message *Descriptor) { } oneofField := oFields[*field.OneofIndex] - tag = "protobuf:" + g.goTag(message, field, wiretype) sf := oneofSubField{ fieldCommon: fieldCommon{ goName: fieldName, diff --git a/protoc-gen-gogo/testdata/deprecated/deprecated.pb.go b/protoc-gen-gogo/testdata/deprecated/deprecated.pb.go index 43b97b19ab..eac2845776 100644 --- a/protoc-gen-gogo/testdata/deprecated/deprecated.pb.go +++ b/protoc-gen-gogo/testdata/deprecated/deprecated.pb.go @@ -125,7 +125,7 @@ type isDeprecatedResponse_DeprecatedOneof interface { } type DeprecatedResponse_DeprecatedOneofField struct { - DeprecatedOneofField string `protobuf:"bytes,2,opt,name=deprecated_oneof_field,json=deprecatedOneofField,proto3,oneof"` + DeprecatedOneofField string `protobuf:"bytes,2,opt,name=deprecated_oneof_field,json=deprecatedOneofField,proto3,oneof" json:"deprecated_oneof_field,omitempty"` } func (*DeprecatedResponse_DeprecatedOneofField) isDeprecatedResponse_DeprecatedOneof() {} diff --git a/protoc-gen-gogo/testdata/import_public/sub/a.pb.go b/protoc-gen-gogo/testdata/import_public/sub/a.pb.go index 9116ac5ff7..f8430ef02f 100644 --- a/protoc-gen-gogo/testdata/import_public/sub/a.pb.go +++ b/protoc-gen-gogo/testdata/import_public/sub/a.pb.go @@ -176,10 +176,10 @@ type isM_OneofField interface { } type M_OneofInt32 struct { - OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,oneof"` + OneofInt32 int32 `protobuf:"varint,2,opt,name=oneof_int32,json=oneofInt32,oneof" json:"oneof_int32,omitempty"` } type M_OneofInt64 struct { - OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,oneof"` + OneofInt64 int64 `protobuf:"varint,3,opt,name=oneof_int64,json=oneofInt64,oneof" json:"oneof_int64,omitempty"` } func (*M_OneofInt32) isM_OneofField() {} @@ -312,10 +312,10 @@ type isM_Submessage_SubmessageOneofField interface { } type M_Submessage_SubmessageOneofInt32 struct { - SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,oneof"` + SubmessageOneofInt32 int32 `protobuf:"varint,1,opt,name=submessage_oneof_int32,json=submessageOneofInt32,oneof" json:"submessage_oneof_int32,omitempty"` } type M_Submessage_SubmessageOneofInt64 struct { - SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,oneof"` + SubmessageOneofInt64 int64 `protobuf:"varint,2,opt,name=submessage_oneof_int64,json=submessageOneofInt64,oneof" json:"submessage_oneof_int64,omitempty"` } func (*M_Submessage_SubmessageOneofInt32) isM_Submessage_SubmessageOneofField() {} diff --git a/protoc-gen-gogo/testdata/my_test/test.pb.go b/protoc-gen-gogo/testdata/my_test/test.pb.go index a89abd4e94..6978d1b23b 100644 --- a/protoc-gen-gogo/testdata/my_test/test.pb.go +++ b/protoc-gen-gogo/testdata/my_test/test.pb.go @@ -743,34 +743,34 @@ type isCommunique_Union interface { } type Communique_Number struct { - Number int32 `protobuf:"varint,5,opt,name=number,oneof"` + Number int32 `protobuf:"varint,5,opt,name=number,oneof" json:"number,omitempty"` } type Communique_Name struct { - Name string `protobuf:"bytes,6,opt,name=name,oneof"` + Name string `protobuf:"bytes,6,opt,name=name,oneof" json:"name,omitempty"` } type Communique_Data struct { - Data []byte `protobuf:"bytes,7,opt,name=data,oneof"` + Data []byte `protobuf:"bytes,7,opt,name=data,oneof" json:"data,omitempty"` } type Communique_TempC struct { - TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"` + TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof" json:"temp_c,omitempty"` } type Communique_Height struct { - Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"` + Height float32 `protobuf:"fixed32,9,opt,name=height,oneof" json:"height,omitempty"` } type Communique_Today struct { - Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"` + Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof" json:"today,omitempty"` } type Communique_Maybe struct { - Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"` + Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof" json:"maybe,omitempty"` } type Communique_Delta_ struct { - Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"` + Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof" json:"delta,omitempty"` } type Communique_Msg struct { - Msg *Reply `protobuf:"bytes,16,opt,name=msg,oneof"` + Msg *Reply `protobuf:"bytes,16,opt,name=msg,oneof" json:"msg,omitempty"` } type Communique_Somegroup struct { - Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"` + Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof" json:"somegroup,omitempty"` } func (*Communique_Number) isCommunique_Union() {} diff --git a/test/issue322/issue322.pb.go b/test/issue322/issue322.pb.go index 1bd153fd9f..e5c0cdb729 100644 --- a/test/issue322/issue322.pb.go +++ b/test/issue322/issue322.pb.go @@ -79,7 +79,7 @@ type isOneofTest_Union interface { } type OneofTest_I struct { - I int32 `protobuf:"varint,1,opt,name=i,oneof,def=4"` + I int32 `protobuf:"varint,1,opt,name=i,oneof,def=4" json:"i,omitempty"` } func (*OneofTest_I) isOneofTest_Union() {} diff --git a/test/issue617/issue617.pb.go b/test/issue617/issue617.pb.go index b3a7744066..3f8ee6597d 100644 --- a/test/issue617/issue617.pb.go +++ b/test/issue617/issue617.pb.go @@ -72,7 +72,7 @@ type isFoo_Details interface { } type Foo_Bar_ struct { - Bar *Foo_Bar `protobuf:"bytes,1,opt,name=bar,proto3,oneof"` + Bar *Foo_Bar `protobuf:"bytes,1,opt,name=bar,proto3,oneof" json:"bar,omitempty"` } func (*Foo_Bar_) isFoo_Details() {} diff --git a/test/oneof/combos/both/one.pb.go b/test/oneof/combos/both/one.pb.go index ef827249d2..742c6c9e53 100644 --- a/test/oneof/combos/both/one.pb.go +++ b/test/oneof/combos/both/one.pb.go @@ -138,52 +138,52 @@ type isAllTypesOneOf_TestOneof interface { } type AllTypesOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type AllTypesOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type AllTypesOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type AllTypesOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof" json:"Field4,omitempty"` } type AllTypesOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof" json:"Field5,omitempty"` } type AllTypesOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof" json:"Field6,omitempty"` } type AllTypesOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof" json:"Field7,omitempty"` } type AllTypesOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof" json:"Field8,omitempty"` } type AllTypesOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof" json:"Field9,omitempty"` } type AllTypesOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof" json:"Field10,omitempty"` } type AllTypesOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof" json:"Field11,omitempty"` } type AllTypesOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof" json:"Field12,omitempty"` } type AllTypesOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof" json:"Field13,omitempty"` } type AllTypesOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof" json:"Field14,omitempty"` } type AllTypesOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof" json:"Field15,omitempty"` } type AllTypesOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof" json:"sub_message,omitempty"` } func (*AllTypesOneOf_Field1) isAllTypesOneOf_TestOneof() {} @@ -410,22 +410,22 @@ type isTwoOneofs_Two interface { } type TwoOneofs_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type TwoOneofs_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type TwoOneofs_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type TwoOneofs_Field34 struct { - Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof"` + Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof" json:"Field34,omitempty"` } type TwoOneofs_Field35 struct { - Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof"` + Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof" json:"Field35,omitempty"` } type TwoOneofs_SubMessage2 struct { - SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof"` + SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof" json:"sub_message2,omitempty"` } func (*TwoOneofs_Field1) isTwoOneofs_One() {} @@ -556,16 +556,16 @@ type isCustomOneof_Custom interface { } type CustomOneof_Stringy struct { - Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof"` + Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof" json:"Stringy,omitempty"` } type CustomOneof_CustomType struct { - CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128"` + CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128" json:"CustomType,omitempty"` } type CustomOneof_CastType struct { - CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type"` + CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type" json:"CastType,omitempty"` } type CustomOneof_MyCustomName struct { - MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof"` + MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof" json:"CustomName,omitempty"` } func (*CustomOneof_Stringy) isCustomOneof_Custom() {} diff --git a/test/oneof/combos/marshaler/one.pb.go b/test/oneof/combos/marshaler/one.pb.go index 67848eaa3b..7759eea97a 100644 --- a/test/oneof/combos/marshaler/one.pb.go +++ b/test/oneof/combos/marshaler/one.pb.go @@ -137,52 +137,52 @@ type isAllTypesOneOf_TestOneof interface { } type AllTypesOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type AllTypesOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type AllTypesOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type AllTypesOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof" json:"Field4,omitempty"` } type AllTypesOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof" json:"Field5,omitempty"` } type AllTypesOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof" json:"Field6,omitempty"` } type AllTypesOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof" json:"Field7,omitempty"` } type AllTypesOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof" json:"Field8,omitempty"` } type AllTypesOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof" json:"Field9,omitempty"` } type AllTypesOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof" json:"Field10,omitempty"` } type AllTypesOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof" json:"Field11,omitempty"` } type AllTypesOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof" json:"Field12,omitempty"` } type AllTypesOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof" json:"Field13,omitempty"` } type AllTypesOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof" json:"Field14,omitempty"` } type AllTypesOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof" json:"Field15,omitempty"` } type AllTypesOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof" json:"sub_message,omitempty"` } func (*AllTypesOneOf_Field1) isAllTypesOneOf_TestOneof() {} @@ -409,22 +409,22 @@ type isTwoOneofs_Two interface { } type TwoOneofs_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type TwoOneofs_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type TwoOneofs_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type TwoOneofs_Field34 struct { - Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof"` + Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof" json:"Field34,omitempty"` } type TwoOneofs_Field35 struct { - Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof"` + Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof" json:"Field35,omitempty"` } type TwoOneofs_SubMessage2 struct { - SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof"` + SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof" json:"sub_message2,omitempty"` } func (*TwoOneofs_Field1) isTwoOneofs_One() {} @@ -555,16 +555,16 @@ type isCustomOneof_Custom interface { } type CustomOneof_Stringy struct { - Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof"` + Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof" json:"Stringy,omitempty"` } type CustomOneof_CustomType struct { - CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128"` + CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128" json:"CustomType,omitempty"` } type CustomOneof_CastType struct { - CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type"` + CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type" json:"CastType,omitempty"` } type CustomOneof_MyCustomName struct { - MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof"` + MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof" json:"CustomName,omitempty"` } func (*CustomOneof_Stringy) isCustomOneof_Custom() {} diff --git a/test/oneof/combos/neither/one.pb.go b/test/oneof/combos/neither/one.pb.go index 9bbbd936f9..5a4dc8efff 100644 --- a/test/oneof/combos/neither/one.pb.go +++ b/test/oneof/combos/neither/one.pb.go @@ -117,52 +117,52 @@ type isAllTypesOneOf_TestOneof interface { } type AllTypesOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type AllTypesOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type AllTypesOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type AllTypesOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof" json:"Field4,omitempty"` } type AllTypesOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof" json:"Field5,omitempty"` } type AllTypesOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof" json:"Field6,omitempty"` } type AllTypesOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof" json:"Field7,omitempty"` } type AllTypesOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof" json:"Field8,omitempty"` } type AllTypesOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof" json:"Field9,omitempty"` } type AllTypesOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof" json:"Field10,omitempty"` } type AllTypesOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof" json:"Field11,omitempty"` } type AllTypesOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof" json:"Field12,omitempty"` } type AllTypesOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof" json:"Field13,omitempty"` } type AllTypesOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof" json:"Field14,omitempty"` } type AllTypesOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof" json:"Field15,omitempty"` } type AllTypesOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof" json:"sub_message,omitempty"` } func (*AllTypesOneOf_Field1) isAllTypesOneOf_TestOneof() {} @@ -378,22 +378,22 @@ type isTwoOneofs_Two interface { } type TwoOneofs_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type TwoOneofs_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type TwoOneofs_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type TwoOneofs_Field34 struct { - Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof"` + Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof" json:"Field34,omitempty"` } type TwoOneofs_Field35 struct { - Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof"` + Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof" json:"Field35,omitempty"` } type TwoOneofs_SubMessage2 struct { - SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof"` + SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof" json:"sub_message2,omitempty"` } func (*TwoOneofs_Field1) isTwoOneofs_One() {} @@ -514,16 +514,16 @@ type isCustomOneof_Custom interface { } type CustomOneof_Stringy struct { - Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof"` + Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof" json:"Stringy,omitempty"` } type CustomOneof_CustomType struct { - CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128"` + CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128" json:"CustomType,omitempty"` } type CustomOneof_CastType struct { - CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type"` + CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type" json:"CastType,omitempty"` } type CustomOneof_MyCustomName struct { - MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof"` + MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof" json:"CustomName,omitempty"` } func (*CustomOneof_Stringy) isCustomOneof_Custom() {} diff --git a/test/oneof/combos/unmarshaler/one.pb.go b/test/oneof/combos/unmarshaler/one.pb.go index 5551c0929d..3af665c455 100644 --- a/test/oneof/combos/unmarshaler/one.pb.go +++ b/test/oneof/combos/unmarshaler/one.pb.go @@ -119,52 +119,52 @@ type isAllTypesOneOf_TestOneof interface { } type AllTypesOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type AllTypesOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type AllTypesOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type AllTypesOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,oneof" json:"Field4,omitempty"` } type AllTypesOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,oneof" json:"Field5,omitempty"` } type AllTypesOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,oneof" json:"Field6,omitempty"` } type AllTypesOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,oneof" json:"Field7,omitempty"` } type AllTypesOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,oneof" json:"Field8,omitempty"` } type AllTypesOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,oneof" json:"Field9,omitempty"` } type AllTypesOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,oneof" json:"Field10,omitempty"` } type AllTypesOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,oneof" json:"Field11,omitempty"` } type AllTypesOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,oneof" json:"Field12,omitempty"` } type AllTypesOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,oneof" json:"Field13,omitempty"` } type AllTypesOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,oneof" json:"Field14,omitempty"` } type AllTypesOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,oneof" json:"Field15,omitempty"` } type AllTypesOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,oneof" json:"sub_message,omitempty"` } func (*AllTypesOneOf_Field1) isAllTypesOneOf_TestOneof() {} @@ -380,22 +380,22 @@ type isTwoOneofs_Two interface { } type TwoOneofs_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,oneof" json:"Field1,omitempty"` } type TwoOneofs_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,oneof" json:"Field2,omitempty"` } type TwoOneofs_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,oneof" json:"Field3,omitempty"` } type TwoOneofs_Field34 struct { - Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof"` + Field34 string `protobuf:"bytes,34,opt,name=Field34,oneof" json:"Field34,omitempty"` } type TwoOneofs_Field35 struct { - Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof"` + Field35 []byte `protobuf:"bytes,35,opt,name=Field35,oneof" json:"Field35,omitempty"` } type TwoOneofs_SubMessage2 struct { - SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof"` + SubMessage2 *Subby `protobuf:"bytes,36,opt,name=sub_message2,json=subMessage2,oneof" json:"sub_message2,omitempty"` } func (*TwoOneofs_Field1) isTwoOneofs_One() {} @@ -516,16 +516,16 @@ type isCustomOneof_Custom interface { } type CustomOneof_Stringy struct { - Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof"` + Stringy string `protobuf:"bytes,34,opt,name=Stringy,oneof" json:"Stringy,omitempty"` } type CustomOneof_CustomType struct { - CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128"` + CustomType github_com_gogo_protobuf_test_custom.Uint128 `protobuf:"bytes,35,opt,name=CustomType,oneof,customtype=github.com/gogo/protobuf/test/custom.Uint128" json:"CustomType,omitempty"` } type CustomOneof_CastType struct { - CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type"` + CastType github_com_gogo_protobuf_test_casttype.MyUint64Type `protobuf:"varint,36,opt,name=CastType,oneof,casttype=github.com/gogo/protobuf/test/casttype.MyUint64Type" json:"CastType,omitempty"` } type CustomOneof_MyCustomName struct { - MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof"` + MyCustomName int64 `protobuf:"varint,37,opt,name=CustomName,oneof" json:"CustomName,omitempty"` } func (*CustomOneof_Stringy) isCustomOneof_Custom() {} diff --git a/test/oneof3/combos/both/one.pb.go b/test/oneof3/combos/both/one.pb.go index 4f526a5507..d5f0b4c406 100644 --- a/test/oneof3/combos/both/one.pb.go +++ b/test/oneof3/combos/both/one.pb.go @@ -136,52 +136,52 @@ type isSampleOneOf_TestOneof interface { } type SampleOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof" json:"Field1,omitempty"` } type SampleOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof" json:"Field2,omitempty"` } type SampleOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof" json:"Field3,omitempty"` } type SampleOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof" json:"Field4,omitempty"` } type SampleOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof" json:"Field5,omitempty"` } type SampleOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof" json:"Field6,omitempty"` } type SampleOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof" json:"Field7,omitempty"` } type SampleOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof" json:"Field8,omitempty"` } type SampleOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof" json:"Field9,omitempty"` } type SampleOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof" json:"Field10,omitempty"` } type SampleOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof" json:"Field11,omitempty"` } type SampleOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof" json:"Field12,omitempty"` } type SampleOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof" json:"Field13,omitempty"` } type SampleOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof" json:"Field14,omitempty"` } type SampleOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof" json:"Field15,omitempty"` } type SampleOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof" json:"sub_message,omitempty"` } func (*SampleOneOf_Field1) isSampleOneOf_TestOneof() {} diff --git a/test/oneof3/combos/marshaler/one.pb.go b/test/oneof3/combos/marshaler/one.pb.go index e4947416d3..8809eeac06 100644 --- a/test/oneof3/combos/marshaler/one.pb.go +++ b/test/oneof3/combos/marshaler/one.pb.go @@ -135,52 +135,52 @@ type isSampleOneOf_TestOneof interface { } type SampleOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof" json:"Field1,omitempty"` } type SampleOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof" json:"Field2,omitempty"` } type SampleOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof" json:"Field3,omitempty"` } type SampleOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof" json:"Field4,omitempty"` } type SampleOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof" json:"Field5,omitempty"` } type SampleOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof" json:"Field6,omitempty"` } type SampleOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof" json:"Field7,omitempty"` } type SampleOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof" json:"Field8,omitempty"` } type SampleOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof" json:"Field9,omitempty"` } type SampleOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof" json:"Field10,omitempty"` } type SampleOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof" json:"Field11,omitempty"` } type SampleOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof" json:"Field12,omitempty"` } type SampleOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof" json:"Field13,omitempty"` } type SampleOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof" json:"Field14,omitempty"` } type SampleOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof" json:"Field15,omitempty"` } type SampleOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof" json:"sub_message,omitempty"` } func (*SampleOneOf_Field1) isSampleOneOf_TestOneof() {} diff --git a/test/oneof3/combos/neither/one.pb.go b/test/oneof3/combos/neither/one.pb.go index 3a74364096..a4e690d862 100644 --- a/test/oneof3/combos/neither/one.pb.go +++ b/test/oneof3/combos/neither/one.pb.go @@ -115,52 +115,52 @@ type isSampleOneOf_TestOneof interface { } type SampleOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof" json:"Field1,omitempty"` } type SampleOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof" json:"Field2,omitempty"` } type SampleOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof" json:"Field3,omitempty"` } type SampleOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof" json:"Field4,omitempty"` } type SampleOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof" json:"Field5,omitempty"` } type SampleOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof" json:"Field6,omitempty"` } type SampleOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof" json:"Field7,omitempty"` } type SampleOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof" json:"Field8,omitempty"` } type SampleOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof" json:"Field9,omitempty"` } type SampleOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof" json:"Field10,omitempty"` } type SampleOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof" json:"Field11,omitempty"` } type SampleOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof" json:"Field12,omitempty"` } type SampleOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof" json:"Field13,omitempty"` } type SampleOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof" json:"Field14,omitempty"` } type SampleOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof" json:"Field15,omitempty"` } type SampleOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof" json:"sub_message,omitempty"` } func (*SampleOneOf_Field1) isSampleOneOf_TestOneof() {} diff --git a/test/oneof3/combos/unmarshaler/one.pb.go b/test/oneof3/combos/unmarshaler/one.pb.go index a13643e8f3..bd5aa7ba3c 100644 --- a/test/oneof3/combos/unmarshaler/one.pb.go +++ b/test/oneof3/combos/unmarshaler/one.pb.go @@ -117,52 +117,52 @@ type isSampleOneOf_TestOneof interface { } type SampleOneOf_Field1 struct { - Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof"` + Field1 float64 `protobuf:"fixed64,1,opt,name=Field1,proto3,oneof" json:"Field1,omitempty"` } type SampleOneOf_Field2 struct { - Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof"` + Field2 float32 `protobuf:"fixed32,2,opt,name=Field2,proto3,oneof" json:"Field2,omitempty"` } type SampleOneOf_Field3 struct { - Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof"` + Field3 int32 `protobuf:"varint,3,opt,name=Field3,proto3,oneof" json:"Field3,omitempty"` } type SampleOneOf_Field4 struct { - Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof"` + Field4 int64 `protobuf:"varint,4,opt,name=Field4,proto3,oneof" json:"Field4,omitempty"` } type SampleOneOf_Field5 struct { - Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof"` + Field5 uint32 `protobuf:"varint,5,opt,name=Field5,proto3,oneof" json:"Field5,omitempty"` } type SampleOneOf_Field6 struct { - Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof"` + Field6 uint64 `protobuf:"varint,6,opt,name=Field6,proto3,oneof" json:"Field6,omitempty"` } type SampleOneOf_Field7 struct { - Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof"` + Field7 int32 `protobuf:"zigzag32,7,opt,name=Field7,proto3,oneof" json:"Field7,omitempty"` } type SampleOneOf_Field8 struct { - Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof"` + Field8 int64 `protobuf:"zigzag64,8,opt,name=Field8,proto3,oneof" json:"Field8,omitempty"` } type SampleOneOf_Field9 struct { - Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof"` + Field9 uint32 `protobuf:"fixed32,9,opt,name=Field9,proto3,oneof" json:"Field9,omitempty"` } type SampleOneOf_Field10 struct { - Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof"` + Field10 int32 `protobuf:"fixed32,10,opt,name=Field10,proto3,oneof" json:"Field10,omitempty"` } type SampleOneOf_Field11 struct { - Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof"` + Field11 uint64 `protobuf:"fixed64,11,opt,name=Field11,proto3,oneof" json:"Field11,omitempty"` } type SampleOneOf_Field12 struct { - Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof"` + Field12 int64 `protobuf:"fixed64,12,opt,name=Field12,proto3,oneof" json:"Field12,omitempty"` } type SampleOneOf_Field13 struct { - Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof"` + Field13 bool `protobuf:"varint,13,opt,name=Field13,proto3,oneof" json:"Field13,omitempty"` } type SampleOneOf_Field14 struct { - Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof"` + Field14 string `protobuf:"bytes,14,opt,name=Field14,proto3,oneof" json:"Field14,omitempty"` } type SampleOneOf_Field15 struct { - Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof"` + Field15 []byte `protobuf:"bytes,15,opt,name=Field15,proto3,oneof" json:"Field15,omitempty"` } type SampleOneOf_SubMessage struct { - SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof"` + SubMessage *Subby `protobuf:"bytes,16,opt,name=sub_message,json=subMessage,proto3,oneof" json:"sub_message,omitempty"` } func (*SampleOneOf_Field1) isSampleOneOf_TestOneof() {} diff --git a/test/oneofembed/oneofembed.pb.go b/test/oneofembed/oneofembed.pb.go index 967192fcac..802af73ad1 100644 --- a/test/oneofembed/oneofembed.pb.go +++ b/test/oneofembed/oneofembed.pb.go @@ -94,10 +94,10 @@ type isBar_Pick interface { } type Bar_A struct { - A bool `protobuf:"varint,11,opt,name=a,proto3,oneof"` + A bool `protobuf:"varint,11,opt,name=a,proto3,oneof" json:"a,omitempty"` } type Bar_B struct { - B bool `protobuf:"varint,12,opt,name=b,proto3,oneof"` + B bool `protobuf:"varint,12,opt,name=b,proto3,oneof" json:"b,omitempty"` } func (*Bar_A) isBar_Pick() {} diff --git a/test/stdtypes/stdtypes.pb.go b/test/stdtypes/stdtypes.pb.go index cd51f6c8d2..5982afe97d 100644 --- a/test/stdtypes/stdtypes.pb.go +++ b/test/stdtypes/stdtypes.pb.go @@ -699,37 +699,37 @@ type isOneofStdTypes_OneOfStdTimes interface { } type OneofStdTypes_Timestamp struct { - Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime"` + Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime" json:"timestamp,omitempty"` } type OneofStdTypes_Duration struct { - Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration"` + Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration" json:"duration,omitempty"` } type OneofStdTypes_RepDouble struct { - RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr"` + RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr" json:"repDouble,omitempty"` } type OneofStdTypes_RepFloat struct { - RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr"` + RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr" json:"repFloat,omitempty"` } type OneofStdTypes_RepInt64 struct { - RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr"` + RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr" json:"repInt64,omitempty"` } type OneofStdTypes_RepUInt64 struct { - RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr"` + RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr" json:"repUInt64,omitempty"` } type OneofStdTypes_RepInt32 struct { - RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr"` + RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr" json:"repInt32,omitempty"` } type OneofStdTypes_RepUInt32 struct { - RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr"` + RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr" json:"repUInt32,omitempty"` } type OneofStdTypes_RepBool struct { - RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr"` + RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr" json:"repBool,omitempty"` } type OneofStdTypes_RepString struct { - RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr"` + RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr" json:"repString,omitempty"` } type OneofStdTypes_RepBytes struct { - RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr"` + RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr" json:"repBytes,omitempty"` } func (*OneofStdTypes_Timestamp) isOneofStdTypes_OneOfStdTimes() {} diff --git a/test/tags/tags.pb.go b/test/tags/tags.pb.go index 60374cfd57..1c98be26eb 100644 --- a/test/tags/tags.pb.go +++ b/test/tags/tags.pb.go @@ -22,11 +22,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Outside struct { - *Inside `protobuf:"bytes,1,opt,name=Inside,embedded=Inside" json:""` - Field2 *string `protobuf:"bytes,2,opt,name=Field2" json:"MyField2" xml:",comment"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + *Inside `protobuf:"bytes,1,opt,name=Inside,embedded=Inside" json:""` + Field2 *string `protobuf:"bytes,2,opt,name=Field2" json:"MyField2" xml:",comment"` + // Types that are valid to be assigned to Filed: + // *Outside_Field3 + Filed isOutside_Filed `protobuf_oneof:"filed"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Outside) Reset() { *m = Outside{} } @@ -53,6 +56,23 @@ func (m *Outside) XXX_DiscardUnknown() { var xxx_messageInfo_Outside proto.InternalMessageInfo +type isOutside_Filed interface { + isOutside_Filed() +} + +type Outside_Field3 struct { + Field3 string `protobuf:"bytes,3,opt,name=Field3,oneof" json:"MyField3" xml:",comment"` +} + +func (*Outside_Field3) isOutside_Filed() {} + +func (m *Outside) GetFiled() isOutside_Filed { + if m != nil { + return m.Filed + } + return nil +} + func (m *Outside) GetField2() string { if m != nil && m.Field2 != nil { return *m.Field2 @@ -60,6 +80,20 @@ func (m *Outside) GetField2() string { return "" } +func (m *Outside) GetField3() string { + if x, ok := m.GetFiled().(*Outside_Field3); ok { + return x.Field3 + } + return "" +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Outside) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Outside_Field3)(nil), + } +} + type Inside struct { Field1 *string `protobuf:"bytes,1,opt,name=Field1" json:"MyField1" xml:",chardata"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -106,20 +140,22 @@ func init() { func init() { proto.RegisterFile("tags.proto", fileDescriptor_e7d9cbcae1e528f6) } var fileDescriptor_e7d9cbcae1e528f6 = []byte{ - // 203 bytes of a gzipped FileDescriptorProto + // 231 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x4c, 0x2f, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0xb1, 0xa5, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x92, 0x49, 0xa5, - 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x34, 0x29, 0x15, 0x72, 0xb1, 0xfb, 0x97, 0x96, 0x14, - 0x67, 0xa6, 0xa4, 0x0a, 0xe9, 0x71, 0xb1, 0x79, 0xe6, 0x81, 0x58, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, - 0xdc, 0x46, 0x3c, 0x7a, 0x60, 0xc3, 0x21, 0x62, 0x4e, 0x1c, 0x17, 0xee, 0xc9, 0x33, 0xbe, 0xba, - 0x27, 0xcf, 0x10, 0x04, 0x55, 0x25, 0x64, 0xc6, 0xc5, 0xe6, 0x96, 0x99, 0x9a, 0x93, 0x62, 0x24, - 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0xf7, 0xea, 0x9e, 0x3c, 0x87, 0x6f, 0x25, 0x44, 0xec, - 0xd3, 0x3d, 0x79, 0xbe, 0x8a, 0xdc, 0x1c, 0x2b, 0x25, 0x9d, 0xe4, 0xfc, 0xdc, 0xdc, 0xd4, 0xbc, - 0x12, 0xa5, 0x20, 0xa8, 0x6a, 0x25, 0x47, 0x98, 0x3d, 0x42, 0xe6, 0x50, 0x13, 0x0c, 0xc1, 0x36, - 0x72, 0x3a, 0xc9, 0x23, 0x99, 0x60, 0xf8, 0xe9, 0x9e, 0x3c, 0x3f, 0xd4, 0x84, 0x8c, 0xc4, 0xa2, - 0x94, 0xc4, 0x92, 0x44, 0x98, 0x11, 0x86, 0x4e, 0x2c, 0x3f, 0x1e, 0xca, 0x31, 0x02, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x57, 0x12, 0x09, 0x10, 0xfd, 0x00, 0x00, 0x00, + 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x34, 0x29, 0x6d, 0x61, 0xe4, 0x62, 0xf7, 0x2f, 0x2d, + 0x29, 0xce, 0x4c, 0x49, 0x15, 0xd2, 0xe3, 0x62, 0xf3, 0xcc, 0x03, 0xb1, 0x24, 0x18, 0x15, 0x18, + 0x35, 0xb8, 0x8d, 0x78, 0xf4, 0xc0, 0xa6, 0x43, 0xc4, 0x9c, 0x38, 0x2e, 0xdc, 0x93, 0x67, 0x7c, + 0x75, 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0x4a, 0xc8, 0x8c, 0x8b, 0xcd, 0x2d, 0x33, 0x35, 0x27, 0xc5, + 0x48, 0x82, 0x49, 0x81, 0x51, 0x83, 0xd3, 0x49, 0xee, 0xd5, 0x3d, 0x79, 0x0e, 0xdf, 0x4a, 0x88, + 0xd8, 0xa7, 0x7b, 0xf2, 0x7c, 0x15, 0xb9, 0x39, 0x56, 0x4a, 0x3a, 0xc9, 0xf9, 0xb9, 0xb9, 0xa9, + 0x79, 0x25, 0x4a, 0x41, 0x50, 0xd5, 0x42, 0x16, 0x50, 0x7d, 0xc6, 0x12, 0xcc, 0x18, 0xfa, 0x8c, + 0x31, 0xf5, 0x79, 0x30, 0x40, 0x75, 0x1a, 0x3b, 0xb1, 0x73, 0xb1, 0xa6, 0x65, 0xe6, 0xa4, 0xa6, + 0x28, 0x39, 0xc2, 0x9c, 0x2a, 0x64, 0x0e, 0x35, 0xcc, 0x10, 0xec, 0x68, 0x4e, 0x27, 0x79, 0x24, + 0xc3, 0x0c, 0x3f, 0xdd, 0x93, 0xe7, 0x87, 0x1a, 0x96, 0x91, 0x58, 0x94, 0x92, 0x58, 0x92, 0x08, + 0x73, 0x85, 0xa1, 0x13, 0xcb, 0x8f, 0x87, 0x72, 0x8c, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x23, + 0x9e, 0x05, 0xb9, 0x41, 0x01, 0x00, 0x00, } func NewPopulatedOutside(r randyTags, easy bool) *Outside { @@ -131,12 +167,22 @@ func NewPopulatedOutside(r randyTags, easy bool) *Outside { v1 := string(randStringTags(r)) this.Field2 = &v1 } + oneofNumber_Filed := []int32{3}[r.Intn(1)] + switch oneofNumber_Filed { + case 3: + this.Filed = NewPopulatedOutside_Field3(r, easy) + } if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTags(r, 3) + this.XXX_unrecognized = randUnrecognizedTags(r, 4) } return this } +func NewPopulatedOutside_Field3(r randyTags, easy bool) *Outside_Field3 { + this := &Outside_Field3{} + this.Field3 = string(randStringTags(r)) + return this +} func NewPopulatedInside(r randyTags, easy bool) *Inside { this := &Inside{} if r.Intn(5) != 0 { diff --git a/test/tags/tags.proto b/test/tags/tags.proto index f4ef2a68de..3f82b2382b 100644 --- a/test/tags/tags.proto +++ b/test/tags/tags.proto @@ -37,6 +37,9 @@ option (gogoproto.populate_all) = true; message Outside { optional Inside Inside = 1 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""]; optional string Field2 = 2 [(gogoproto.jsontag) = "MyField2", (gogoproto.moretags) = "xml:\",comment\""]; + oneof filed { + string Field3 = 3 [(gogoproto.jsontag) = "MyField3", (gogoproto.moretags) = "xml:\",comment\""]; + } } message Inside { diff --git a/test/tags/tags_test.go b/test/tags/tags_test.go index 18db0f8a20..ca472a4ef7 100644 --- a/test/tags/tags_test.go +++ b/test/tags/tags_test.go @@ -29,91 +29,46 @@ package tags import ( - "bytes" - "encoding/json" - "encoding/xml" - math_rand "math/rand" + "reflect" "testing" - "time" ) -type MyJson struct { - MyField1 string - MyField2 string -} - -func NewPopulatedMyJson(r randyTags) *MyJson { - this := &MyJson{} - if r.Intn(10) != 0 { - this.MyField1 = randStringTags(r) - } - if r.Intn(10) != 0 { - this.MyField2 = randStringTags(r) - } - return this -} - -func TestJson(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - msg1 := NewPopulatedMyJson(popr) - data, err := json.Marshal(msg1) - if err != nil { - panic(err) - } - outside := &Outside{} - err = json.Unmarshal(data, outside) - if err != nil { - panic(err) - } - if outside.GetField1() != msg1.MyField1 { - t.Fatalf("proto field1 %s != %s", outside.GetField1(), msg1.MyField1) - } - if outside.GetField2() != msg1.MyField2 { - t.Fatalf("proto field2 %s != %s", outside.GetField2(), msg1.MyField2) - } - data2, err := json.Marshal(outside) - if err != nil { - panic(err) - } - msg2 := &MyJson{} - err = json.Unmarshal(data2, msg2) - if err != nil { - panic(err) - } - if msg2.MyField1 != msg1.MyField1 { - t.Fatalf("proto field1 %s != %s", msg2.MyField1, msg1.MyField1) - } - if msg2.MyField2 != msg1.MyField2 { - t.Fatalf("proto field2 %s != %s", msg2.MyField2, msg1.MyField2) - } -} +func TestTags(t *testing.T) { -func TestXml(t *testing.T) { - s := "Field1Value0" - field1 := "Field1Value" - field2 := "Field2Value" - msg1 := &Outside{} - err := xml.Unmarshal([]byte(s), msg1) - if err != nil { - panic(err) - } - msg2 := &Outside{ - Inside: &Inside{ - Field1: &field1, + var tests = []struct { + value interface{} + field string + jsontag string + xmltag string + }{ + { + value: Inside{}, + field: "Field1", + jsontag: "MyField1", + xmltag: ",chardata", + }, + { + value: Outside{}, + field: "Field2", + jsontag: "MyField2", + xmltag: ",comment", + }, + { + value: Outside_Field3{}, + field: "Field3", + jsontag: "MyField3", + xmltag: ",comment", }, - Field2: &field2, - } - if msg1.GetField1() != msg2.GetField1() { - t.Fatalf("field1 expected %s got %s", msg2.GetField1(), msg1.GetField1()) - } - if err != nil { - panic(err) - } - data, err := xml.Marshal(msg2) - if err != nil { - panic(err) } - if !bytes.Equal(data, []byte(s)) { - t.Fatalf("expected %s got %s", s, string(data)) + + for _, tt := range tests { + tv := reflect.ValueOf(tt.value).Type() + f, _ := tv.FieldByName(tt.field) + if jsontag := f.Tag.Get("json"); jsontag != tt.jsontag { + t.Fatalf("proto %q type: json tag %s != %s", tv.Name(), jsontag, tt.jsontag) + } + if xmltag := f.Tag.Get("xml"); xmltag != tt.xmltag { + t.Fatalf("proto %q type: xml tag %s != %s", tv.Name(), xmltag, tt.xmltag) + } } } diff --git a/test/types/combos/both/types.pb.go b/test/types/combos/both/types.pb.go index 1aa5d651eb..e5d512d2d8 100644 --- a/test/types/combos/both/types.pb.go +++ b/test/types/combos/both/types.pb.go @@ -1515,37 +1515,37 @@ type isOneofProtoTypes_OneOfProtoTimes interface { } type OneofProtoTypes_Timestamp struct { - Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof"` + Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof" json:"timestamp,omitempty"` } type OneofProtoTypes_Duration struct { - Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof"` + Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof" json:"duration,omitempty"` } type OneofProtoTypes_RepDouble struct { - RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof"` + RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof" json:"repDouble,omitempty"` } type OneofProtoTypes_RepFloat struct { - RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof"` + RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof" json:"repFloat,omitempty"` } type OneofProtoTypes_RepInt64 struct { - RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof"` + RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof" json:"repInt64,omitempty"` } type OneofProtoTypes_RepUInt64 struct { - RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof"` + RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof" json:"repUInt64,omitempty"` } type OneofProtoTypes_RepInt32 struct { - RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof"` + RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof" json:"repInt32,omitempty"` } type OneofProtoTypes_RepUInt32 struct { - RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof"` + RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof" json:"repUInt32,omitempty"` } type OneofProtoTypes_RepBool struct { - RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof"` + RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof" json:"repBool,omitempty"` } type OneofProtoTypes_RepString struct { - RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof"` + RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof" json:"repString,omitempty"` } type OneofProtoTypes_RepBytes struct { - RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof"` + RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof" json:"repBytes,omitempty"` } func (*OneofProtoTypes_Timestamp) isOneofProtoTypes_OneOfProtoTimes() {} @@ -1722,37 +1722,37 @@ type isOneofStdTypes_OneOfStdTimes interface { } type OneofStdTypes_Timestamp struct { - Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime"` + Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime" json:"timestamp,omitempty"` } type OneofStdTypes_Duration struct { - Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration"` + Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration" json:"duration,omitempty"` } type OneofStdTypes_RepDouble struct { - RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr"` + RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr" json:"repDouble,omitempty"` } type OneofStdTypes_RepFloat struct { - RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr"` + RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr" json:"repFloat,omitempty"` } type OneofStdTypes_RepInt64 struct { - RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr"` + RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr" json:"repInt64,omitempty"` } type OneofStdTypes_RepUInt64 struct { - RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr"` + RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr" json:"repUInt64,omitempty"` } type OneofStdTypes_RepInt32 struct { - RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr"` + RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr" json:"repInt32,omitempty"` } type OneofStdTypes_RepUInt32 struct { - RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr"` + RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr" json:"repUInt32,omitempty"` } type OneofStdTypes_RepBool struct { - RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr"` + RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr" json:"repBool,omitempty"` } type OneofStdTypes_RepString struct { - RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr"` + RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr" json:"repString,omitempty"` } type OneofStdTypes_RepBytes struct { - RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr"` + RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr" json:"repBytes,omitempty"` } func (*OneofStdTypes_Timestamp) isOneofStdTypes_OneOfStdTimes() {} diff --git a/test/types/combos/marshaler/types.pb.go b/test/types/combos/marshaler/types.pb.go index 7bf1f5a66a..ff0800d4c3 100644 --- a/test/types/combos/marshaler/types.pb.go +++ b/test/types/combos/marshaler/types.pb.go @@ -1514,37 +1514,37 @@ type isOneofProtoTypes_OneOfProtoTimes interface { } type OneofProtoTypes_Timestamp struct { - Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof"` + Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof" json:"timestamp,omitempty"` } type OneofProtoTypes_Duration struct { - Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof"` + Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof" json:"duration,omitempty"` } type OneofProtoTypes_RepDouble struct { - RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof"` + RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof" json:"repDouble,omitempty"` } type OneofProtoTypes_RepFloat struct { - RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof"` + RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof" json:"repFloat,omitempty"` } type OneofProtoTypes_RepInt64 struct { - RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof"` + RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof" json:"repInt64,omitempty"` } type OneofProtoTypes_RepUInt64 struct { - RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof"` + RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof" json:"repUInt64,omitempty"` } type OneofProtoTypes_RepInt32 struct { - RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof"` + RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof" json:"repInt32,omitempty"` } type OneofProtoTypes_RepUInt32 struct { - RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof"` + RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof" json:"repUInt32,omitempty"` } type OneofProtoTypes_RepBool struct { - RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof"` + RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof" json:"repBool,omitempty"` } type OneofProtoTypes_RepString struct { - RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof"` + RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof" json:"repString,omitempty"` } type OneofProtoTypes_RepBytes struct { - RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof"` + RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof" json:"repBytes,omitempty"` } func (*OneofProtoTypes_Timestamp) isOneofProtoTypes_OneOfProtoTimes() {} @@ -1721,37 +1721,37 @@ type isOneofStdTypes_OneOfStdTimes interface { } type OneofStdTypes_Timestamp struct { - Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime"` + Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime" json:"timestamp,omitempty"` } type OneofStdTypes_Duration struct { - Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration"` + Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration" json:"duration,omitempty"` } type OneofStdTypes_RepDouble struct { - RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr"` + RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr" json:"repDouble,omitempty"` } type OneofStdTypes_RepFloat struct { - RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr"` + RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr" json:"repFloat,omitempty"` } type OneofStdTypes_RepInt64 struct { - RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr"` + RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr" json:"repInt64,omitempty"` } type OneofStdTypes_RepUInt64 struct { - RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr"` + RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr" json:"repUInt64,omitempty"` } type OneofStdTypes_RepInt32 struct { - RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr"` + RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr" json:"repInt32,omitempty"` } type OneofStdTypes_RepUInt32 struct { - RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr"` + RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr" json:"repUInt32,omitempty"` } type OneofStdTypes_RepBool struct { - RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr"` + RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr" json:"repBool,omitempty"` } type OneofStdTypes_RepString struct { - RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr"` + RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr" json:"repString,omitempty"` } type OneofStdTypes_RepBytes struct { - RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr"` + RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr" json:"repBytes,omitempty"` } func (*OneofStdTypes_Timestamp) isOneofStdTypes_OneOfStdTimes() {} diff --git a/test/types/combos/neither/types.pb.go b/test/types/combos/neither/types.pb.go index a023702ccd..ceb79578cc 100644 --- a/test/types/combos/neither/types.pb.go +++ b/test/types/combos/neither/types.pb.go @@ -1441,37 +1441,37 @@ type isOneofProtoTypes_OneOfProtoTimes interface { } type OneofProtoTypes_Timestamp struct { - Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof"` + Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof" json:"timestamp,omitempty"` } type OneofProtoTypes_Duration struct { - Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof"` + Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof" json:"duration,omitempty"` } type OneofProtoTypes_RepDouble struct { - RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof"` + RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof" json:"repDouble,omitempty"` } type OneofProtoTypes_RepFloat struct { - RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof"` + RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof" json:"repFloat,omitempty"` } type OneofProtoTypes_RepInt64 struct { - RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof"` + RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof" json:"repInt64,omitempty"` } type OneofProtoTypes_RepUInt64 struct { - RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof"` + RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof" json:"repUInt64,omitempty"` } type OneofProtoTypes_RepInt32 struct { - RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof"` + RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof" json:"repInt32,omitempty"` } type OneofProtoTypes_RepUInt32 struct { - RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof"` + RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof" json:"repUInt32,omitempty"` } type OneofProtoTypes_RepBool struct { - RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof"` + RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof" json:"repBool,omitempty"` } type OneofProtoTypes_RepString struct { - RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof"` + RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof" json:"repString,omitempty"` } type OneofProtoTypes_RepBytes struct { - RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof"` + RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof" json:"repBytes,omitempty"` } func (*OneofProtoTypes_Timestamp) isOneofProtoTypes_OneOfProtoTimes() {} @@ -1638,37 +1638,37 @@ type isOneofStdTypes_OneOfStdTimes interface { } type OneofStdTypes_Timestamp struct { - Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime"` + Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime" json:"timestamp,omitempty"` } type OneofStdTypes_Duration struct { - Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration"` + Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration" json:"duration,omitempty"` } type OneofStdTypes_RepDouble struct { - RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr"` + RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr" json:"repDouble,omitempty"` } type OneofStdTypes_RepFloat struct { - RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr"` + RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr" json:"repFloat,omitempty"` } type OneofStdTypes_RepInt64 struct { - RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr"` + RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr" json:"repInt64,omitempty"` } type OneofStdTypes_RepUInt64 struct { - RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr"` + RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr" json:"repUInt64,omitempty"` } type OneofStdTypes_RepInt32 struct { - RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr"` + RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr" json:"repInt32,omitempty"` } type OneofStdTypes_RepUInt32 struct { - RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr"` + RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr" json:"repUInt32,omitempty"` } type OneofStdTypes_RepBool struct { - RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr"` + RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr" json:"repBool,omitempty"` } type OneofStdTypes_RepString struct { - RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr"` + RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr" json:"repString,omitempty"` } type OneofStdTypes_RepBytes struct { - RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr"` + RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr" json:"repBytes,omitempty"` } func (*OneofStdTypes_Timestamp) isOneofStdTypes_OneOfStdTimes() {} diff --git a/test/types/combos/unmarshaler/types.pb.go b/test/types/combos/unmarshaler/types.pb.go index 29583b28ea..25d910957d 100644 --- a/test/types/combos/unmarshaler/types.pb.go +++ b/test/types/combos/unmarshaler/types.pb.go @@ -1442,37 +1442,37 @@ type isOneofProtoTypes_OneOfProtoTimes interface { } type OneofProtoTypes_Timestamp struct { - Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof"` + Timestamp *types.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof" json:"timestamp,omitempty"` } type OneofProtoTypes_Duration struct { - Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof"` + Duration *types.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof" json:"duration,omitempty"` } type OneofProtoTypes_RepDouble struct { - RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof"` + RepDouble *types.DoubleValue `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof" json:"repDouble,omitempty"` } type OneofProtoTypes_RepFloat struct { - RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof"` + RepFloat *types.FloatValue `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof" json:"repFloat,omitempty"` } type OneofProtoTypes_RepInt64 struct { - RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof"` + RepInt64 *types.Int64Value `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof" json:"repInt64,omitempty"` } type OneofProtoTypes_RepUInt64 struct { - RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof"` + RepUInt64 *types.UInt64Value `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof" json:"repUInt64,omitempty"` } type OneofProtoTypes_RepInt32 struct { - RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof"` + RepInt32 *types.Int32Value `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof" json:"repInt32,omitempty"` } type OneofProtoTypes_RepUInt32 struct { - RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof"` + RepUInt32 *types.UInt32Value `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof" json:"repUInt32,omitempty"` } type OneofProtoTypes_RepBool struct { - RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof"` + RepBool *types.BoolValue `protobuf:"bytes,9,opt,name=repBool,proto3,oneof" json:"repBool,omitempty"` } type OneofProtoTypes_RepString struct { - RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof"` + RepString *types.StringValue `protobuf:"bytes,10,opt,name=repString,proto3,oneof" json:"repString,omitempty"` } type OneofProtoTypes_RepBytes struct { - RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof"` + RepBytes *types.BytesValue `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof" json:"repBytes,omitempty"` } func (*OneofProtoTypes_Timestamp) isOneofProtoTypes_OneOfProtoTimes() {} @@ -1639,37 +1639,37 @@ type isOneofStdTypes_OneOfStdTimes interface { } type OneofStdTypes_Timestamp struct { - Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime"` + Timestamp *time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,oneof,stdtime" json:"timestamp,omitempty"` } type OneofStdTypes_Duration struct { - Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration"` + Duration *time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,oneof,stdduration" json:"duration,omitempty"` } type OneofStdTypes_RepDouble struct { - RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr"` + RepDouble *float64 `protobuf:"bytes,3,opt,name=repDouble,proto3,oneof,wktptr" json:"repDouble,omitempty"` } type OneofStdTypes_RepFloat struct { - RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr"` + RepFloat *float32 `protobuf:"bytes,4,opt,name=repFloat,proto3,oneof,wktptr" json:"repFloat,omitempty"` } type OneofStdTypes_RepInt64 struct { - RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr"` + RepInt64 *int64 `protobuf:"bytes,5,opt,name=repInt64,proto3,oneof,wktptr" json:"repInt64,omitempty"` } type OneofStdTypes_RepUInt64 struct { - RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr"` + RepUInt64 *uint64 `protobuf:"bytes,6,opt,name=repUInt64,proto3,oneof,wktptr" json:"repUInt64,omitempty"` } type OneofStdTypes_RepInt32 struct { - RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr"` + RepInt32 *int32 `protobuf:"bytes,7,opt,name=repInt32,proto3,oneof,wktptr" json:"repInt32,omitempty"` } type OneofStdTypes_RepUInt32 struct { - RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr"` + RepUInt32 *uint32 `protobuf:"bytes,8,opt,name=repUInt32,proto3,oneof,wktptr" json:"repUInt32,omitempty"` } type OneofStdTypes_RepBool struct { - RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr"` + RepBool *bool `protobuf:"bytes,9,opt,name=repBool,proto3,oneof,wktptr" json:"repBool,omitempty"` } type OneofStdTypes_RepString struct { - RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr"` + RepString *string `protobuf:"bytes,10,opt,name=repString,proto3,oneof,wktptr" json:"repString,omitempty"` } type OneofStdTypes_RepBytes struct { - RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr"` + RepBytes *[]byte `protobuf:"bytes,11,opt,name=repBytes,proto3,oneof,wktptr" json:"repBytes,omitempty"` } func (*OneofStdTypes_Timestamp) isOneofStdTypes_OneOfStdTimes() {} diff --git a/types/struct.pb.go b/types/struct.pb.go index deffae83ab..1266843845 100644 --- a/types/struct.pb.go +++ b/types/struct.pb.go @@ -177,22 +177,22 @@ type isValue_Kind interface { } type Value_NullValue struct { - NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` + NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof" json:"null_value,omitempty"` } type Value_NumberValue struct { - NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` + NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof" json:"number_value,omitempty"` } type Value_StringValue struct { - StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof" json:"string_value,omitempty"` } type Value_BoolValue struct { - BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof" json:"bool_value,omitempty"` } type Value_StructValue struct { - StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` + StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof" json:"struct_value,omitempty"` } type Value_ListValue struct { - ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` + ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof" json:"list_value,omitempty"` } func (*Value_NullValue) isValue_Kind() {}