cmd/protoc-gen-go: generate oneof types seperately
Seperate out the generation of the oneof wrapper types from the
code block that is about getter methods.
Change-Id: Ief44ef953d0b5ad8c998a8542c830ca70468a3bf
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/171029
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/testprotos/test3/test.pb.go b/internal/testprotos/test3/test.pb.go
index ad26119..2b5379e 100644
--- a/internal/testprotos/test3/test.pb.go
+++ b/internal/testprotos/test3/test.pb.go
@@ -609,64 +609,6 @@
return nil
}
-type isTestAllTypes_OneofField interface {
- isTestAllTypes_OneofField()
-}
-
-type TestAllTypes_OneofUint32 struct {
- OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"`
-}
-
-type TestAllTypes_OneofNestedMessage struct {
- OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"`
-}
-
-type TestAllTypes_OneofString struct {
- OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"`
-}
-
-type TestAllTypes_OneofBytes struct {
- OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
-}
-
-type TestAllTypes_OneofBool struct {
- OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"`
-}
-
-type TestAllTypes_OneofUint64 struct {
- OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"`
-}
-
-type TestAllTypes_OneofFloat struct {
- OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"`
-}
-
-type TestAllTypes_OneofDouble struct {
- OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"`
-}
-
-type TestAllTypes_OneofEnum struct {
- OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=goproto.proto.test3.TestAllTypes_NestedEnum,oneof"`
-}
-
-func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {}
-
-func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {}
-
func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {
if m != nil {
return m.OneofField
@@ -752,6 +694,64 @@
}
}
+type isTestAllTypes_OneofField interface {
+ isTestAllTypes_OneofField()
+}
+
+type TestAllTypes_OneofUint32 struct {
+ OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"`
+}
+
+type TestAllTypes_OneofNestedMessage struct {
+ OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"`
+}
+
+type TestAllTypes_OneofString struct {
+ OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"`
+}
+
+type TestAllTypes_OneofBytes struct {
+ OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
+}
+
+type TestAllTypes_OneofBool struct {
+ OneofBool bool `protobuf:"varint,115,opt,name=oneof_bool,json=oneofBool,proto3,oneof"`
+}
+
+type TestAllTypes_OneofUint64 struct {
+ OneofUint64 uint64 `protobuf:"varint,116,opt,name=oneof_uint64,json=oneofUint64,proto3,oneof"`
+}
+
+type TestAllTypes_OneofFloat struct {
+ OneofFloat float32 `protobuf:"fixed32,117,opt,name=oneof_float,json=oneofFloat,proto3,oneof"`
+}
+
+type TestAllTypes_OneofDouble struct {
+ OneofDouble float64 `protobuf:"fixed64,118,opt,name=oneof_double,json=oneofDouble,proto3,oneof"`
+}
+
+type TestAllTypes_OneofEnum struct {
+ OneofEnum TestAllTypes_NestedEnum `protobuf:"varint,119,opt,name=oneof_enum,json=oneofEnum,proto3,enum=goproto.proto.test3.TestAllTypes_NestedEnum,oneof"`
+}
+
+func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofBool) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofUint64) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofFloat) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofDouble) isTestAllTypes_OneofField() {}
+
+func (*TestAllTypes_OneofEnum) isTestAllTypes_OneofField() {}
+
type ForeignMessage struct {
C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"`
D int32 `protobuf:"varint,2,opt,name=d,proto3" json:"d,omitempty"`