cmd/protoc-gen-go: perform some code cleanup
Minor changes:
* Use x as the receiver since "e" and "m" are meaningless in the presence
of user-defined enum and message names.
* Consistently keep enum methods together, rather awkwardly split apart
by the value maps.
Change-Id: I68e5666efb56ac7a4d062fb223b9f826dc72aba9
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/170357
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/cmd/protoc-gen-go-grpc/testdata/grpc/grpc.pb.go b/cmd/protoc-gen-go-grpc/testdata/grpc/grpc.pb.go
index c438dfa..4f84300 100644
--- a/cmd/protoc-gen-go-grpc/testdata/grpc/grpc.pb.go
+++ b/cmd/protoc-gen-go-grpc/testdata/grpc/grpc.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Request) ProtoReflect() protoreflect.Message {
- return xxx_File_grpc_grpc_proto_messageTypes[0].MessageOf(m)
+func (x *Request) Reset() {
+ *x = Request{}
}
-func (m *Request) Reset() { *m = Request{} }
-func (m *Request) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Request) ProtoMessage() {}
+
+func (x *Request) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Request) ProtoMessage() {}
+
+func (x *Request) ProtoReflect() protoreflect.Message {
+ return xxx_File_grpc_grpc_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Request.ProtoReflect.Type instead.
func (*Request) Descriptor() ([]byte, []int) {
@@ -36,12 +43,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Response) ProtoReflect() protoreflect.Message {
- return xxx_File_grpc_grpc_proto_messageTypes[1].MessageOf(m)
+func (x *Response) Reset() {
+ *x = Response{}
}
-func (m *Response) Reset() { *m = Response{} }
-func (m *Response) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Response) ProtoMessage() {}
+
+func (x *Response) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Response) ProtoMessage() {}
+
+func (x *Response) ProtoReflect() protoreflect.Message {
+ return xxx_File_grpc_grpc_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use Response.ProtoReflect.Type instead.
func (*Response) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/annotation_test.go b/cmd/protoc-gen-go/annotation_test.go
index 1f38d5a..beecdfe 100644
--- a/cmd/protoc-gen-go/annotation_test.go
+++ b/cmd/protoc-gen-go/annotation_test.go
@@ -47,7 +47,7 @@
"\t", "AnnotationsTestField", " ",
[]int32{fieldnum.FileDescriptorProto_MessageType, 0, fieldnum.DescriptorProto_Field, 0},
}, {
- "func (m *AnnotationsTestMessage) ", "GetAnnotationsTestField", "() string {",
+ "func (x *AnnotationsTestMessage) ", "GetAnnotationsTestField", "() string {",
[]int32{fieldnum.FileDescriptorProto_MessageType, 0, fieldnum.DescriptorProto_Field, 0},
}} {
s := want.prefix + want.text + want.suffix
diff --git a/cmd/protoc-gen-go/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go
index 95d7072..1b05a43 100644
--- a/cmd/protoc-gen-go/internal_gengo/main.go
+++ b/cmd/protoc-gen-go/internal_gengo/main.go
@@ -207,10 +207,13 @@
}
func genEnum(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, enum *protogen.Enum) {
+ // Enum type declaration.
g.PrintLeadingComments(enum.Location)
g.Annotate(enum.GoIdent.GoName, enum.Location)
g.P("type ", enum.GoIdent, " int32",
deprecationComment(enum.Desc.Options().(*descriptorpb.EnumOptions).GetDeprecated()))
+
+ // Enum value constants.
g.P("const (")
for _, value := range enum.Values {
g.PrintLeadingComments(value.Location)
@@ -221,9 +224,7 @@
g.P(")")
g.P()
- // Generate support for protobuf reflection.
- genReflectEnum(gen, g, f, enum)
-
+ // Enum value mapping (number -> name).
nameMap := enum.GoIdent.GoName + "_name"
g.P("// Deprecated: Use ", enum.GoIdent.GoName, ".Type.Values instead.")
g.P("var ", nameMap, " = map[int32]string{")
@@ -239,6 +240,7 @@
g.P("}")
g.P()
+ // Enum value mapping (name -> number).
valueMap := enum.GoIdent.GoName + "_value"
g.P("// Deprecated: Use ", enum.GoIdent.GoName, ".Type.Values instead.")
g.P("var ", valueMap, " = map[string]int32{")
@@ -248,17 +250,22 @@
g.P("}")
g.P()
+ // Enum method.
if enum.Desc.Syntax() != protoreflect.Proto3 {
g.P("func (x ", enum.GoIdent, ") Enum() *", enum.GoIdent, " {")
g.P("return &x")
g.P("}")
g.P()
}
+ // String method.
g.P("func (x ", enum.GoIdent, ") String() string {")
g.P("return ", protoimplPackage.Ident("X"), ".EnumStringOf(x.Type(), ", protoreflectPackage.Ident("EnumNumber"), "(x))")
g.P("}")
g.P()
+ genReflectEnum(gen, g, f, enum)
+
+ // UnmarshalJSON method.
if enum.Desc.Syntax() == protoreflect.Proto2 {
g.P("// Deprecated: Do not use.")
g.P("func (x *", enum.GoIdent, ") UnmarshalJSON(b []byte) error {")
@@ -272,6 +279,7 @@
g.P()
}
+ // EnumDescriptor method.
var indexes []string
for i := 1; i < len(enum.Location.Path); i += 2 {
indexes = append(indexes, strconv.Itoa(int(enum.Location.Path[i])))
@@ -285,13 +293,12 @@
genWellKnownType(g, "", enum.GoIdent, enum.Desc)
}
-// enumRegistryName returns the name used to register an enum with the proto
-// package registry.
+// enumLegacyName returns the name used by the v1 proto package.
//
// Confusingly, this is <proto_package>.<go_ident>. This probably should have
// been the full name of the proto enum type instead, but changing it at this
// point would require thought.
-func enumRegistryName(enum *protogen.Enum) string {
+func enumLegacyName(enum *protogen.Enum) string {
// Find the FileDescriptor for this enum.
var desc protoreflect.Descriptor = enum.Desc
for {
@@ -313,6 +320,7 @@
return
}
+ // Message type declaration.
hasComment := g.PrintLeadingComments(message.Location)
if message.Desc.Options().(*descriptorpb.MessageOptions).GetDeprecated() {
if hasComment {
@@ -369,16 +377,23 @@
g.P("}")
g.P()
- // Generate support for protobuf reflection.
+ // Reset method.
+ g.P("func (x *", message.GoIdent, ") Reset() {")
+ g.P("*x = ", message.GoIdent, "{}")
+ g.P("}")
+ g.P()
+ // String method.
+ g.P("func (x *", message.GoIdent, ") String() string {")
+ g.P("return ", protoimplPackage.Ident("X"), ".MessageStringOf(x)")
+ g.P("}")
+ g.P()
+ // ProtoMessage method.
+ g.P("func (*", message.GoIdent, ") ProtoMessage() {}")
+ g.P()
+
genReflectMessage(gen, g, f, message)
- // Reset
- g.P("func (m *", message.GoIdent, ") Reset() { *m = ", message.GoIdent, "{} }")
- // String
- g.P("func (m *", message.GoIdent, ") String() string { return ", protoimplPackage.Ident("X"), ".MessageStringOf(m) }")
- // ProtoMessage
- g.P("func (*", message.GoIdent, ") ProtoMessage() {}")
- // Descriptor
+ // Descriptor method.
var indexes []string
for i := 1; i < len(message.Location.Path); i += 2 {
indexes = append(indexes, strconv.Itoa(int(message.Location.Path[i])))
@@ -389,7 +404,7 @@
g.P("}")
g.P()
- // ExtensionRangeArray
+ // ExtensionRangeArray method.
if extranges := message.Desc.ExtensionRanges(); extranges.Len() > 0 {
protoExtRange := protoifacePackage.Ident("ExtensionRangeV1")
extRangeVar := "extRange_" + message.GoIdent.GoName
@@ -459,7 +474,7 @@
}
g.P()
- // Getters.
+ // Getter methods.
for _, field := range message.Fields {
if field.OneofType != nil {
if field == field.OneofType.Fields[0] {
@@ -472,22 +487,22 @@
g.P(deprecationComment(true))
}
g.Annotate(message.GoIdent.GoName+".Get"+field.GoName, field.Location)
- g.P("func (m *", message.GoIdent, ") Get", field.GoName, "() ", goType, " {")
+ g.P("func (x *", message.GoIdent, ") Get", field.GoName, "() ", goType, " {")
if field.OneofType != nil {
- g.P("if x, ok := m.Get", field.OneofType.GoName, "().(*", fieldOneofType(field), "); ok {")
+ g.P("if x, ok := x.Get", field.OneofType.GoName, "().(*", fieldOneofType(field), "); ok {")
g.P("return x.", field.GoName)
g.P("}")
} else {
if field.Desc.Syntax() == protoreflect.Proto3 || defaultValue == "nil" {
- g.P("if m != nil {")
+ g.P("if x != nil {")
} else {
- g.P("if m != nil && m.", field.GoName, " != nil {")
+ g.P("if x != nil && x.", field.GoName, " != nil {")
}
star := ""
if pointer {
star = "*"
}
- g.P("return ", star, " m.", field.GoName)
+ g.P("return ", star, " x.", field.GoName)
g.P("}")
}
g.P("return ", defaultValue)
@@ -550,7 +565,7 @@
func fieldProtobufTag(field *protogen.Field) string {
var enumName string
if field.Desc.Kind() == protoreflect.EnumKind {
- enumName = enumRegistryName(field.EnumType)
+ enumName = enumLegacyName(field.EnumType)
}
return tag.Marshal(field.Desc, enumName)
}
@@ -679,6 +694,8 @@
return "// Deprecated: Do not use."
}
+// TODO: Remove this. This was added to aid jsonpb, but jsonpb does this work
+// through the use of protobuf reflection now.
func genWellKnownType(g *protogen.GeneratedFile, ptr string, ident protogen.GoIdent, desc protoreflect.Descriptor) {
if wellKnownTypes[desc.FullName()] {
g.P("func (", ptr, ident, `) XXX_WellKnownType() string { return "`, desc.Name(), `" }`)
diff --git a/cmd/protoc-gen-go/internal_gengo/reflect.go b/cmd/protoc-gen-go/internal_gengo/reflect.go
index 69b5acd..2d0a9ff 100644
--- a/cmd/protoc-gen-go/internal_gengo/reflect.go
+++ b/cmd/protoc-gen-go/internal_gengo/reflect.go
@@ -242,20 +242,29 @@
func genReflectEnum(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, enum *protogen.Enum) {
idx := f.allEnumsByPtr[enum]
typesVar := enumTypesVarName(f)
- g.P("func (e ", enum.GoIdent, ") Type() ", protoreflectPackage.Ident("EnumType"), " {")
+
+ // Type method.
+ g.P("func (", enum.GoIdent, ") Type() ", protoreflectPackage.Ident("EnumType"), " {")
g.P("return ", typesVar, "[", idx, "]")
g.P("}")
- g.P("func (e ", enum.GoIdent, ") Number() ", protoreflectPackage.Ident("EnumNumber"), " {")
- g.P("return ", protoreflectPackage.Ident("EnumNumber"), "(e)")
+ g.P()
+
+ // Number method.
+ g.P("func (x ", enum.GoIdent, ") Number() ", protoreflectPackage.Ident("EnumNumber"), " {")
+ g.P("return ", protoreflectPackage.Ident("EnumNumber"), "(x)")
g.P("}")
+ g.P()
}
func genReflectMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, message *protogen.Message) {
idx := f.allMessagesByPtr[message]
typesVar := messageTypesVarName(f)
- g.P("func (m *", message.GoIdent, ") ProtoReflect() ", protoreflectPackage.Ident("Message"), " {")
- g.P("return ", typesVar, "[", idx, "].MessageOf(m)")
+
+ // ProtoReflect method.
+ g.P("func (x *", message.GoIdent, ") ProtoReflect() ", protoreflectPackage.Ident("Message"), " {")
+ g.P("return ", typesVar, "[", idx, "].MessageOf(x)")
g.P("}")
+ g.P()
}
func rawDescVarName(f *fileInfo) string {
diff --git a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
index b17f3ea..e4e3e06 100644
--- a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
+++ b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
@@ -18,13 +18,6 @@
AnnotationsTestEnum_ANNOTATIONS_TEST_ENUM_VALUE AnnotationsTestEnum = 0
)
-func (e AnnotationsTestEnum) Type() protoreflect.EnumType {
- return xxx_File_annotations_annotations_proto_enumTypes[0]
-}
-func (e AnnotationsTestEnum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use AnnotationsTestEnum.Type.Values instead.
var AnnotationsTestEnum_name = map[int32]string{
0: "ANNOTATIONS_TEST_ENUM_VALUE",
@@ -43,6 +36,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (AnnotationsTestEnum) Type() protoreflect.EnumType {
+ return xxx_File_annotations_annotations_proto_enumTypes[0]
+}
+
+func (x AnnotationsTestEnum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *AnnotationsTestEnum) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -65,21 +66,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *AnnotationsTestMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_annotations_annotations_proto_messageTypes[0].MessageOf(m)
+func (x *AnnotationsTestMessage) Reset() {
+ *x = AnnotationsTestMessage{}
}
-func (m *AnnotationsTestMessage) Reset() { *m = AnnotationsTestMessage{} }
-func (m *AnnotationsTestMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*AnnotationsTestMessage) ProtoMessage() {}
+
+func (x *AnnotationsTestMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AnnotationsTestMessage) ProtoMessage() {}
+
+func (x *AnnotationsTestMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_annotations_annotations_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use AnnotationsTestMessage.ProtoReflect.Type instead.
func (*AnnotationsTestMessage) Descriptor() ([]byte, []int) {
return xxx_File_annotations_annotations_proto_rawDescGZIP(), []int{0}
}
-func (m *AnnotationsTestMessage) GetAnnotationsTestField() string {
- if m != nil && m.AnnotationsTestField != nil {
- return *m.AnnotationsTestField
+func (x *AnnotationsTestMessage) GetAnnotationsTestField() string {
+ if x != nil && x.AnnotationsTestField != nil {
+ return *x.AnnotationsTestField
}
return ""
}
diff --git a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go.meta b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go.meta
index 9c2596f..a0f0199 100644
--- a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go.meta
+++ b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go.meta
@@ -1 +1 @@
-annotation:{path:5 path:0 source_file:"annotations/annotations.proto" begin:398 end:417} annotation:{path:5 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:434 end:481} annotation:{path:4 path:0 source_file:"annotations/annotations.proto" begin:1640 end:1662} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:1673 end:1693} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:2535 end:2558}
\ No newline at end of file
+annotation:{path:5 path:0 source_file:"annotations/annotations.proto" begin:398 end:417} annotation:{path:5 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:434 end:481} annotation:{path:4 path:0 source_file:"annotations/annotations.proto" begin:1639 end:1661} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:1672 end:1692} annotation:{path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:2528 end:2551}
\ No newline at end of file
diff --git a/cmd/protoc-gen-go/testdata/comments/comments.pb.go b/cmd/protoc-gen-go/testdata/comments/comments.pb.go
index 55aa839..48a847e 100644
--- a/cmd/protoc-gen-go/testdata/comments/comments.pb.go
+++ b/cmd/protoc-gen-go/testdata/comments/comments.pb.go
@@ -29,21 +29,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message1) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_comments_proto_messageTypes[0].MessageOf(m)
+func (x *Message1) Reset() {
+ *x = Message1{}
}
-func (m *Message1) Reset() { *m = Message1{} }
-func (m *Message1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message1) ProtoMessage() {}
+
+func (x *Message1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message1) ProtoMessage() {}
+
+func (x *Message1) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_comments_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Message1.ProtoReflect.Type instead.
func (*Message1) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawDescGZIP(), []int{0}
}
-func (m *Message1) GetField1A() string {
- if m != nil && m.Field1A != nil {
- return *m.Field1A
+func (x *Message1) GetField1A() string {
+ if x != nil && x.Field1A != nil {
+ return *x.Field1A
}
return ""
}
@@ -65,8 +72,8 @@
return nil
}
-func (m *Message1) GetOneof1AField1() string {
- if x, ok := m.GetOneof1A().(*Message1_Oneof1AField1); ok {
+func (x *Message1) GetOneof1AField1() string {
+ if x, ok := x.GetOneof1A().(*Message1_Oneof1AField1); ok {
return x.Oneof1AField1
}
return ""
@@ -86,12 +93,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message2) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_comments_proto_messageTypes[1].MessageOf(m)
+func (x *Message2) Reset() {
+ *x = Message2{}
}
-func (m *Message2) Reset() { *m = Message2{} }
-func (m *Message2) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message2) ProtoMessage() {}
+
+func (x *Message2) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message2) ProtoMessage() {}
+
+func (x *Message2) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_comments_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use Message2.ProtoReflect.Type instead.
func (*Message2) Descriptor() ([]byte, []int) {
@@ -105,12 +119,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message1_Message1A) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_comments_proto_messageTypes[2].MessageOf(m)
+func (x *Message1_Message1A) Reset() {
+ *x = Message1_Message1A{}
}
-func (m *Message1_Message1A) Reset() { *m = Message1_Message1A{} }
-func (m *Message1_Message1A) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message1_Message1A) ProtoMessage() {}
+
+func (x *Message1_Message1A) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message1_Message1A) ProtoMessage() {}
+
+func (x *Message1_Message1A) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_comments_proto_messageTypes[2].MessageOf(x)
+}
// Deprecated: Use Message1_Message1A.ProtoReflect.Type instead.
func (*Message1_Message1A) Descriptor() ([]byte, []int) {
@@ -124,12 +145,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message1_Message1B) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_comments_proto_messageTypes[3].MessageOf(m)
+func (x *Message1_Message1B) Reset() {
+ *x = Message1_Message1B{}
}
-func (m *Message1_Message1B) Reset() { *m = Message1_Message1B{} }
-func (m *Message1_Message1B) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message1_Message1B) ProtoMessage() {}
+
+func (x *Message1_Message1B) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message1_Message1B) ProtoMessage() {}
+
+func (x *Message1_Message1B) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_comments_proto_messageTypes[3].MessageOf(x)
+}
// Deprecated: Use Message1_Message1B.ProtoReflect.Type instead.
func (*Message1_Message1B) Descriptor() ([]byte, []int) {
@@ -143,12 +171,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message2_Message2A) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_comments_proto_messageTypes[4].MessageOf(m)
+func (x *Message2_Message2A) Reset() {
+ *x = Message2_Message2A{}
}
-func (m *Message2_Message2A) Reset() { *m = Message2_Message2A{} }
-func (m *Message2_Message2A) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message2_Message2A) ProtoMessage() {}
+
+func (x *Message2_Message2A) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message2_Message2A) ProtoMessage() {}
+
+func (x *Message2_Message2A) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_comments_proto_messageTypes[4].MessageOf(x)
+}
// Deprecated: Use Message2_Message2A.ProtoReflect.Type instead.
func (*Message2_Message2A) Descriptor() ([]byte, []int) {
@@ -162,12 +197,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message2_Message2B) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_comments_proto_messageTypes[5].MessageOf(m)
+func (x *Message2_Message2B) Reset() {
+ *x = Message2_Message2B{}
}
-func (m *Message2_Message2B) Reset() { *m = Message2_Message2B{} }
-func (m *Message2_Message2B) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message2_Message2B) ProtoMessage() {}
+
+func (x *Message2_Message2B) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message2_Message2B) ProtoMessage() {}
+
+func (x *Message2_Message2B) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_comments_proto_messageTypes[5].MessageOf(x)
+}
// Deprecated: Use Message2_Message2B.ProtoReflect.Type instead.
func (*Message2_Message2B) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go b/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
index cf11d52..19721de 100644
--- a/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
+++ b/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
@@ -17,13 +17,6 @@
DeprecatedEnum_DEPRECATED DeprecatedEnum = 0 // Deprecated: Do not use.
)
-func (e DeprecatedEnum) Type() protoreflect.EnumType {
- return xxx_File_comments_deprecated_proto_enumTypes[0]
-}
-func (e DeprecatedEnum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use DeprecatedEnum.Type.Values instead.
var DeprecatedEnum_name = map[int32]string{
0: "DEPRECATED",
@@ -38,6 +31,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (DeprecatedEnum) Type() protoreflect.EnumType {
+ return xxx_File_comments_deprecated_proto_enumTypes[0]
+}
+
+func (x DeprecatedEnum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Use DeprecatedEnum.Type instead.
func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) {
return xxx_File_comments_deprecated_proto_rawDescGZIP(), []int{0}
@@ -51,12 +52,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *DeprecatedMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_comments_deprecated_proto_messageTypes[0].MessageOf(m)
+func (x *DeprecatedMessage) Reset() {
+ *x = DeprecatedMessage{}
}
-func (m *DeprecatedMessage) Reset() { *m = DeprecatedMessage{} }
-func (m *DeprecatedMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*DeprecatedMessage) ProtoMessage() {}
+
+func (x *DeprecatedMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeprecatedMessage) ProtoMessage() {}
+
+func (x *DeprecatedMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_comments_deprecated_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use DeprecatedMessage.ProtoReflect.Type instead.
func (*DeprecatedMessage) Descriptor() ([]byte, []int) {
@@ -64,9 +72,9 @@
}
// Deprecated: Do not use.
-func (m *DeprecatedMessage) GetDeprecatedField() string {
- if m != nil {
- return m.DeprecatedField
+func (x *DeprecatedMessage) GetDeprecatedField() string {
+ if x != nil {
+ return x.DeprecatedField
}
return ""
}
diff --git a/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go b/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go
index 1b7cd9a..17e4bd6 100644
--- a/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go
@@ -21,12 +21,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *BaseMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_base_base_proto_messageTypes[0].MessageOf(m)
+func (x *BaseMessage) Reset() {
+ *x = BaseMessage{}
}
-func (m *BaseMessage) Reset() { *m = BaseMessage{} }
-func (m *BaseMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*BaseMessage) ProtoMessage() {}
+
+func (x *BaseMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BaseMessage) ProtoMessage() {}
+
+func (x *BaseMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_base_base_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use BaseMessage.ProtoReflect.Type instead.
func (*BaseMessage) Descriptor() ([]byte, []int) {
@@ -43,9 +50,9 @@
return extRange_BaseMessage
}
-func (m *BaseMessage) GetField() string {
- if m != nil && m.Field != nil {
- return *m.Field
+func (x *BaseMessage) GetField() string {
+ if x != nil && x.Field != nil {
+ return *x.Field
}
return ""
}
@@ -57,12 +64,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *MessageSetWireFormatMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_base_base_proto_messageTypes[1].MessageOf(m)
+func (x *MessageSetWireFormatMessage) Reset() {
+ *x = MessageSetWireFormatMessage{}
}
-func (m *MessageSetWireFormatMessage) Reset() { *m = MessageSetWireFormatMessage{} }
-func (m *MessageSetWireFormatMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*MessageSetWireFormatMessage) ProtoMessage() {}
+
+func (x *MessageSetWireFormatMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MessageSetWireFormatMessage) ProtoMessage() {}
+
+func (x *MessageSetWireFormatMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_base_base_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use MessageSetWireFormatMessage.ProtoReflect.Type instead.
func (*MessageSetWireFormatMessage) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go b/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go
index 851b7ee..8ff2821 100644
--- a/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go
@@ -21,13 +21,6 @@
Enum_ZERO Enum = 0
)
-func (e Enum) Type() protoreflect.EnumType {
- return xxx_File_extensions_ext_ext_proto_enumTypes[0]
-}
-func (e Enum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
@@ -46,6 +39,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (Enum) Type() protoreflect.EnumType {
+ return xxx_File_extensions_ext_ext_proto_enumTypes[0]
+}
+
+func (x Enum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *Enum) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -68,21 +69,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[0].MessageOf(m)
+func (x *Message) Reset() {
+ *x = Message{}
}
-func (m *Message) Reset() { *m = Message{} }
-func (m *Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message) ProtoMessage() {}
+
+func (x *Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message) ProtoMessage() {}
+
+func (x *Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawDescGZIP(), []int{0}
}
-func (m *Message) GetData() []byte {
- if m != nil {
- return m.Data
+func (x *Message) GetData() []byte {
+ if x != nil {
+ return x.Data
}
return nil
}
@@ -94,21 +102,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *ExtensionGroup) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[1].MessageOf(m)
+func (x *ExtensionGroup) Reset() {
+ *x = ExtensionGroup{}
}
-func (m *ExtensionGroup) Reset() { *m = ExtensionGroup{} }
-func (m *ExtensionGroup) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*ExtensionGroup) ProtoMessage() {}
+
+func (x *ExtensionGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtensionGroup) ProtoMessage() {}
+
+func (x *ExtensionGroup) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use ExtensionGroup.ProtoReflect.Type instead.
func (*ExtensionGroup) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawDescGZIP(), []int{1}
}
-func (m *ExtensionGroup) GetExtensionGroup() string {
- if m != nil && m.ExtensionGroup != nil {
- return *m.ExtensionGroup
+func (x *ExtensionGroup) GetExtensionGroup() string {
+ if x != nil && x.ExtensionGroup != nil {
+ return *x.ExtensionGroup
}
return ""
}
@@ -120,12 +135,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *ExtendingMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[2].MessageOf(m)
+func (x *ExtendingMessage) Reset() {
+ *x = ExtendingMessage{}
}
-func (m *ExtendingMessage) Reset() { *m = ExtendingMessage{} }
-func (m *ExtendingMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*ExtendingMessage) ProtoMessage() {}
+
+func (x *ExtendingMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtendingMessage) ProtoMessage() {}
+
+func (x *ExtendingMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[2].MessageOf(x)
+}
// Deprecated: Use ExtendingMessage.ProtoReflect.Type instead.
func (*ExtendingMessage) Descriptor() ([]byte, []int) {
@@ -139,21 +161,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *RepeatedGroup) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[3].MessageOf(m)
+func (x *RepeatedGroup) Reset() {
+ *x = RepeatedGroup{}
}
-func (m *RepeatedGroup) Reset() { *m = RepeatedGroup{} }
-func (m *RepeatedGroup) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*RepeatedGroup) ProtoMessage() {}
+
+func (x *RepeatedGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RepeatedGroup) ProtoMessage() {}
+
+func (x *RepeatedGroup) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[3].MessageOf(x)
+}
// Deprecated: Use RepeatedGroup.ProtoReflect.Type instead.
func (*RepeatedGroup) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawDescGZIP(), []int{3}
}
-func (m *RepeatedGroup) GetRepeatedXGroup() []string {
- if m != nil {
- return m.RepeatedXGroup
+func (x *RepeatedGroup) GetRepeatedXGroup() []string {
+ if x != nil {
+ return x.RepeatedXGroup
}
return nil
}
@@ -166,12 +195,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Extendable) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[4].MessageOf(m)
+func (x *Extendable) Reset() {
+ *x = Extendable{}
}
-func (m *Extendable) Reset() { *m = Extendable{} }
-func (m *Extendable) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Extendable) ProtoMessage() {}
+
+func (x *Extendable) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Extendable) ProtoMessage() {}
+
+func (x *Extendable) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[4].MessageOf(x)
+}
// Deprecated: Use Extendable.ProtoReflect.Type instead.
func (*Extendable) Descriptor() ([]byte, []int) {
@@ -194,12 +230,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *MessageSetWireFormatExtension) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[5].MessageOf(m)
+func (x *MessageSetWireFormatExtension) Reset() {
+ *x = MessageSetWireFormatExtension{}
}
-func (m *MessageSetWireFormatExtension) Reset() { *m = MessageSetWireFormatExtension{} }
-func (m *MessageSetWireFormatExtension) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*MessageSetWireFormatExtension) ProtoMessage() {}
+
+func (x *MessageSetWireFormatExtension) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MessageSetWireFormatExtension) ProtoMessage() {}
+
+func (x *MessageSetWireFormatExtension) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[5].MessageOf(x)
+}
// Deprecated: Use MessageSetWireFormatExtension.ProtoReflect.Type instead.
func (*MessageSetWireFormatExtension) Descriptor() ([]byte, []int) {
@@ -212,12 +255,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message_M) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[6].MessageOf(m)
+func (x *Message_M) Reset() {
+ *x = Message_M{}
}
-func (m *Message_M) Reset() { *m = Message_M{} }
-func (m *Message_M) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message_M) ProtoMessage() {}
+
+func (x *Message_M) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message_M) ProtoMessage() {}
+
+func (x *Message_M) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[6].MessageOf(x)
+}
// Deprecated: Use Message_M.ProtoReflect.Type instead.
func (*Message_M) Descriptor() ([]byte, []int) {
@@ -230,17 +280,20 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *ExtendingMessage_ExtendingMessageSubmessage) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_ext_ext_proto_messageTypes[7].MessageOf(m)
+func (x *ExtendingMessage_ExtendingMessageSubmessage) Reset() {
+ *x = ExtendingMessage_ExtendingMessageSubmessage{}
}
-func (m *ExtendingMessage_ExtendingMessageSubmessage) Reset() {
- *m = ExtendingMessage_ExtendingMessageSubmessage{}
+
+func (x *ExtendingMessage_ExtendingMessageSubmessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
}
-func (m *ExtendingMessage_ExtendingMessageSubmessage) String() string {
- return protoimpl.X.MessageStringOf(m)
-}
+
func (*ExtendingMessage_ExtendingMessageSubmessage) ProtoMessage() {}
+func (x *ExtendingMessage_ExtendingMessageSubmessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_ext_ext_proto_messageTypes[7].MessageOf(x)
+}
+
// Deprecated: Use ExtendingMessage_ExtendingMessageSubmessage.ProtoReflect.Type instead.
func (*ExtendingMessage_ExtendingMessageSubmessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawDescGZIP(), []int{2, 0}
diff --git a/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go b/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go
index ace02cc..ef84692 100644
--- a/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go
@@ -19,21 +19,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *ExtraMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_extra_extra_proto_messageTypes[0].MessageOf(m)
+func (x *ExtraMessage) Reset() {
+ *x = ExtraMessage{}
}
-func (m *ExtraMessage) Reset() { *m = ExtraMessage{} }
-func (m *ExtraMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*ExtraMessage) ProtoMessage() {}
+
+func (x *ExtraMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtraMessage) ProtoMessage() {}
+
+func (x *ExtraMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_extra_extra_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use ExtraMessage.ProtoReflect.Type instead.
func (*ExtraMessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_extra_extra_proto_rawDescGZIP(), []int{0}
}
-func (m *ExtraMessage) GetData() []byte {
- if m != nil {
- return m.Data
+func (x *ExtraMessage) GetData() []byte {
+ if x != nil {
+ return x.Data
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go b/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
index 5acd599..e8d218c 100644
--- a/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
@@ -20,13 +20,6 @@
Enum_ZERO Enum = 0
)
-func (e Enum) Type() protoreflect.EnumType {
- return xxx_File_extensions_proto3_ext3_proto_enumTypes[0]
-}
-func (e Enum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
@@ -41,6 +34,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (Enum) Type() protoreflect.EnumType {
+ return xxx_File_extensions_proto3_ext3_proto_enumTypes[0]
+}
+
+func (x Enum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Use Enum.Type instead.
func (Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_extensions_proto3_ext3_proto_rawDescGZIP(), []int{0}
@@ -52,12 +53,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message) ProtoReflect() protoreflect.Message {
- return xxx_File_extensions_proto3_ext3_proto_messageTypes[0].MessageOf(m)
+func (x *Message) Reset() {
+ *x = Message{}
}
-func (m *Message) Reset() { *m = Message{} }
-func (m *Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message) ProtoMessage() {}
+
+func (x *Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message) ProtoMessage() {}
+
+func (x *Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_extensions_proto3_ext3_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go b/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
index 84405af..cf6cca5 100644
--- a/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
+++ b/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
@@ -57,112 +57,119 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message) ProtoReflect() protoreflect.Message {
- return xxx_File_fieldnames_fieldnames_proto_messageTypes[0].MessageOf(m)
+func (x *Message) Reset() {
+ *x = Message{}
}
-func (m *Message) Reset() { *m = Message{} }
-func (m *Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message) ProtoMessage() {}
+
+func (x *Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message) ProtoMessage() {}
+
+func (x *Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_fieldnames_fieldnames_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_fieldnames_fieldnames_proto_rawDescGZIP(), []int{0}
}
-func (m *Message) GetFieldOne() string {
- if m != nil && m.FieldOne != nil {
- return *m.FieldOne
+func (x *Message) GetFieldOne() string {
+ if x != nil && x.FieldOne != nil {
+ return *x.FieldOne
}
return ""
}
-func (m *Message) GetFieldTwo() string {
- if m != nil && m.FieldTwo != nil {
- return *m.FieldTwo
+func (x *Message) GetFieldTwo() string {
+ if x != nil && x.FieldTwo != nil {
+ return *x.FieldTwo
}
return ""
}
-func (m *Message) GetFieldThree() string {
- if m != nil && m.FieldThree != nil {
- return *m.FieldThree
+func (x *Message) GetFieldThree() string {
+ if x != nil && x.FieldThree != nil {
+ return *x.FieldThree
}
return ""
}
-func (m *Message) GetField_Four() string {
- if m != nil && m.Field_Four != nil {
- return *m.Field_Four
+func (x *Message) GetField_Four() string {
+ if x != nil && x.Field_Four != nil {
+ return *x.Field_Four
}
return ""
}
-func (m *Message) GetDescriptor_() string {
- if m != nil && m.Descriptor_ != nil {
- return *m.Descriptor_
+func (x *Message) GetDescriptor_() string {
+ if x != nil && x.Descriptor_ != nil {
+ return *x.Descriptor_
}
return ""
}
-func (m *Message) GetMarshal_() string {
- if m != nil && m.Marshal_ != nil {
- return *m.Marshal_
+func (x *Message) GetMarshal_() string {
+ if x != nil && x.Marshal_ != nil {
+ return *x.Marshal_
}
return ""
}
-func (m *Message) GetUnmarshal_() string {
- if m != nil && m.Unmarshal_ != nil {
- return *m.Unmarshal_
+func (x *Message) GetUnmarshal_() string {
+ if x != nil && x.Unmarshal_ != nil {
+ return *x.Unmarshal_
}
return ""
}
-func (m *Message) GetProtoMessage_() string {
- if m != nil && m.ProtoMessage_ != nil {
- return *m.ProtoMessage_
+func (x *Message) GetProtoMessage_() string {
+ if x != nil && x.ProtoMessage_ != nil {
+ return *x.ProtoMessage_
}
return ""
}
-func (m *Message) GetCamelCase() string {
- if m != nil && m.CamelCase != nil {
- return *m.CamelCase
+func (x *Message) GetCamelCase() string {
+ if x != nil && x.CamelCase != nil {
+ return *x.CamelCase
}
return ""
}
-func (m *Message) GetCamelCase_() string {
- if m != nil && m.CamelCase_ != nil {
- return *m.CamelCase_
+func (x *Message) GetCamelCase_() string {
+ if x != nil && x.CamelCase_ != nil {
+ return *x.CamelCase_
}
return ""
}
-func (m *Message) GetCamelCase__() string {
- if m != nil && m.CamelCase__ != nil {
- return *m.CamelCase__
+func (x *Message) GetCamelCase__() string {
+ if x != nil && x.CamelCase__ != nil {
+ return *x.CamelCase__
}
return ""
}
-func (m *Message) GetCamelCase___() string {
- if m != nil && m.CamelCase___ != nil {
- return *m.CamelCase___
+func (x *Message) GetCamelCase___() string {
+ if x != nil && x.CamelCase___ != nil {
+ return *x.CamelCase___
}
return ""
}
-func (m *Message) GetGetName() string {
- if m != nil && m.GetName != nil {
- return *m.GetName
+func (x *Message) GetGetName() string {
+ if x != nil && x.GetName != nil {
+ return *x.GetName
}
return ""
}
-func (m *Message) GetName_() string {
- if m != nil && m.Name_ != nil {
- return *m.Name_
+func (x *Message) GetName_() string {
+ if x != nil && x.Name_ != nil {
+ return *x.Name_
}
return ""
}
@@ -184,8 +191,8 @@
return nil
}
-func (m *Message) GetOneofConflictA() string {
- if x, ok := m.GetOneofConflictA_().(*Message_OneofConflictA); ok {
+func (x *Message) GetOneofConflictA() string {
+ if x, ok := x.GetOneofConflictA_().(*Message_OneofConflictA); ok {
return x.OneofConflictA
}
return ""
@@ -214,15 +221,15 @@
return nil
}
-func (m *Message) GetOneofNoConflict() string {
- if x, ok := m.GetOneofConflictB().(*Message_OneofNoConflict); ok {
+func (x *Message) GetOneofNoConflict() string {
+ if x, ok := x.GetOneofConflictB().(*Message_OneofNoConflict); ok {
return x.OneofNoConflict
}
return ""
}
-func (m *Message) GetOneofConflictB_() string {
- if x, ok := m.GetOneofConflictB().(*Message_OneofConflictB_); ok {
+func (x *Message) GetOneofConflictB_() string {
+ if x, ok := x.GetOneofConflictB().(*Message_OneofConflictB_); ok {
return x.OneofConflictB_
}
return ""
@@ -245,8 +252,8 @@
return nil
}
-func (m *Message) GetOneofMessageConflict() string {
- if x, ok := m.GetOneofConflictC().(*Message_OneofMessageConflict_); ok {
+func (x *Message) GetOneofMessageConflict() string {
+ if x, ok := x.GetOneofConflictC().(*Message_OneofMessageConflict_); ok {
return x.OneofMessageConflict
}
return ""
@@ -268,12 +275,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message_OneofMessageConflict) ProtoReflect() protoreflect.Message {
- return xxx_File_fieldnames_fieldnames_proto_messageTypes[1].MessageOf(m)
+func (x *Message_OneofMessageConflict) Reset() {
+ *x = Message_OneofMessageConflict{}
}
-func (m *Message_OneofMessageConflict) Reset() { *m = Message_OneofMessageConflict{} }
-func (m *Message_OneofMessageConflict) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message_OneofMessageConflict) ProtoMessage() {}
+
+func (x *Message_OneofMessageConflict) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message_OneofMessageConflict) ProtoMessage() {}
+
+func (x *Message_OneofMessageConflict) ProtoReflect() protoreflect.Message {
+ return xxx_File_fieldnames_fieldnames_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use Message_OneofMessageConflict.ProtoReflect.Type instead.
func (*Message_OneofMessageConflict) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/import_public/a.pb.go b/cmd/protoc-gen-go/testdata/import_public/a.pb.go
index fc02f6e..af81fce 100644
--- a/cmd/protoc-gen-go/testdata/import_public/a.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/a.pb.go
@@ -65,35 +65,42 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Public) ProtoReflect() protoreflect.Message {
- return xxx_File_import_public_a_proto_messageTypes[0].MessageOf(m)
+func (x *Public) Reset() {
+ *x = Public{}
}
-func (m *Public) Reset() { *m = Public{} }
-func (m *Public) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Public) ProtoMessage() {}
+
+func (x *Public) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Public) ProtoMessage() {}
+
+func (x *Public) ProtoReflect() protoreflect.Message {
+ return xxx_File_import_public_a_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Public.ProtoReflect.Type instead.
func (*Public) Descriptor() ([]byte, []int) {
return xxx_File_import_public_a_proto_rawDescGZIP(), []int{0}
}
-func (m *Public) GetM() *sub.M {
- if m != nil {
- return m.M
+func (x *Public) GetM() *sub.M {
+ if x != nil {
+ return x.M
}
return nil
}
-func (m *Public) GetE() sub.E {
- if m != nil && m.E != nil {
- return *m.E
+func (x *Public) GetE() sub.E {
+ if x != nil && x.E != nil {
+ return *x.E
}
return sub.E_ZERO
}
-func (m *Public) GetLocal() *Local {
- if m != nil {
- return m.Local
+func (x *Public) GetLocal() *Local {
+ if x != nil {
+ return x.Local
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/import_public/b.pb.go b/cmd/protoc-gen-go/testdata/import_public/b.pb.go
index 34a991e..5dcf793 100644
--- a/cmd/protoc-gen-go/testdata/import_public/b.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/b.pb.go
@@ -21,28 +21,35 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Local) ProtoReflect() protoreflect.Message {
- return xxx_File_import_public_b_proto_messageTypes[0].MessageOf(m)
+func (x *Local) Reset() {
+ *x = Local{}
}
-func (m *Local) Reset() { *m = Local{} }
-func (m *Local) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Local) ProtoMessage() {}
+
+func (x *Local) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Local) ProtoMessage() {}
+
+func (x *Local) ProtoReflect() protoreflect.Message {
+ return xxx_File_import_public_b_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Local.ProtoReflect.Type instead.
func (*Local) Descriptor() ([]byte, []int) {
return xxx_File_import_public_b_proto_rawDescGZIP(), []int{0}
}
-func (m *Local) GetM() *sub.M {
- if m != nil {
- return m.M
+func (x *Local) GetM() *sub.M {
+ if x != nil {
+ return x.M
}
return nil
}
-func (m *Local) GetE() sub.E {
- if m != nil && m.E != nil {
- return *m.E
+func (x *Local) GetE() sub.E {
+ if x != nil && x.E != nil {
+ return *x.E
}
return sub.E_ZERO
}
diff --git a/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go b/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go
index 874e622..1a94137 100644
--- a/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/sub/a.pb.go
@@ -25,13 +25,6 @@
E_ZERO E = 0
)
-func (e E) Type() protoreflect.EnumType {
- return xxx_File_import_public_sub_a_proto_enumTypes[0]
-}
-func (e E) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use E.Type.Values instead.
var E_name = map[int32]string{
0: "ZERO",
@@ -50,6 +43,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (E) Type() protoreflect.EnumType {
+ return xxx_File_import_public_sub_a_proto_enumTypes[0]
+}
+
+func (x E) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *E) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -71,13 +72,6 @@
M_M_ZERO M_Subenum = 0
)
-func (e M_Subenum) Type() protoreflect.EnumType {
- return xxx_File_import_public_sub_a_proto_enumTypes[1]
-}
-func (e M_Subenum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use M_Subenum.Type.Values instead.
var M_Subenum_name = map[int32]string{
0: "M_ZERO",
@@ -96,6 +90,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (M_Subenum) Type() protoreflect.EnumType {
+ return xxx_File_import_public_sub_a_proto_enumTypes[1]
+}
+
+func (x M_Subenum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *M_Subenum) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -117,13 +119,6 @@
M_Submessage_M_SUBMESSAGE_ZERO M_Submessage_Submessage_Subenum = 0
)
-func (e M_Submessage_Submessage_Subenum) Type() protoreflect.EnumType {
- return xxx_File_import_public_sub_a_proto_enumTypes[2]
-}
-func (e M_Submessage_Submessage_Subenum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use M_Submessage_Submessage_Subenum.Type.Values instead.
var M_Submessage_Submessage_Subenum_name = map[int32]string{
0: "M_SUBMESSAGE_ZERO",
@@ -142,6 +137,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (M_Submessage_Submessage_Subenum) Type() protoreflect.EnumType {
+ return xxx_File_import_public_sub_a_proto_enumTypes[2]
+}
+
+func (x M_Submessage_Submessage_Subenum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *M_Submessage_Submessage_Subenum) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -173,12 +176,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M) ProtoReflect() protoreflect.Message {
- return xxx_File_import_public_sub_a_proto_messageTypes[0].MessageOf(m)
+func (x *M) Reset() {
+ *x = M{}
}
-func (m *M) Reset() { *m = M{} }
-func (m *M) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M) ProtoMessage() {}
+
+func (x *M) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M) ProtoMessage() {}
+
+func (x *M) ProtoReflect() protoreflect.Message {
+ return xxx_File_import_public_sub_a_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M.ProtoReflect.Type instead.
func (*M) Descriptor() ([]byte, []int) {
@@ -199,30 +209,30 @@
var Default_M_B []byte = []byte("default")
var Default_M_F float64 = math.NaN()
-func (m *M) GetM2() *M2 {
- if m != nil {
- return m.M2
+func (x *M) GetM2() *M2 {
+ if x != nil {
+ return x.M2
}
return nil
}
-func (m *M) GetS() string {
- if m != nil && m.S != nil {
- return *m.S
+func (x *M) GetS() string {
+ if x != nil && x.S != nil {
+ return *x.S
}
return Default_M_S
}
-func (m *M) GetB() []byte {
- if m != nil && m.B != nil {
- return m.B
+func (x *M) GetB() []byte {
+ if x != nil && x.B != nil {
+ return x.B
}
return append([]byte(nil), Default_M_B...)
}
-func (m *M) GetF() float64 {
- if m != nil && m.F != nil {
- return *m.F
+func (x *M) GetF() float64 {
+ if x != nil && x.F != nil {
+ return *x.F
}
return Default_M_F
}
@@ -250,15 +260,15 @@
return nil
}
-func (m *M) GetOneofInt32() int32 {
- if x, ok := m.GetOneofField().(*M_OneofInt32); ok {
+func (x *M) GetOneofInt32() int32 {
+ if x, ok := x.GetOneofField().(*M_OneofInt32); ok {
return x.OneofInt32
}
return 0
}
-func (m *M) GetOneofInt64() int64 {
- if x, ok := m.GetOneofField().(*M_OneofInt64); ok {
+func (x *M) GetOneofInt64() int64 {
+ if x, ok := x.GetOneofField().(*M_OneofInt64); ok {
return x.OneofInt64
}
return 0
@@ -282,12 +292,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M_Submessage) ProtoReflect() protoreflect.Message {
- return xxx_File_import_public_sub_a_proto_messageTypes[1].MessageOf(m)
+func (x *M_Submessage) Reset() {
+ *x = M_Submessage{}
}
-func (m *M_Submessage) Reset() { *m = M_Submessage{} }
-func (m *M_Submessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M_Submessage) ProtoMessage() {}
+
+func (x *M_Submessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M_Submessage) ProtoMessage() {}
+
+func (x *M_Submessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_import_public_sub_a_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use M_Submessage.ProtoReflect.Type instead.
func (*M_Submessage) Descriptor() ([]byte, []int) {
@@ -317,15 +334,15 @@
return nil
}
-func (m *M_Submessage) GetSubmessageOneofInt32() int32 {
- if x, ok := m.GetSubmessageOneofField().(*M_Submessage_SubmessageOneofInt32); ok {
+func (x *M_Submessage) GetSubmessageOneofInt32() int32 {
+ if x, ok := x.GetSubmessageOneofField().(*M_Submessage_SubmessageOneofInt32); ok {
return x.SubmessageOneofInt32
}
return 0
}
-func (m *M_Submessage) GetSubmessageOneofInt64() int64 {
- if x, ok := m.GetSubmessageOneofField().(*M_Submessage_SubmessageOneofInt64); ok {
+func (x *M_Submessage) GetSubmessageOneofInt64() int64 {
+ if x, ok := x.GetSubmessageOneofField().(*M_Submessage_SubmessageOneofInt64); ok {
return x.SubmessageOneofInt64
}
return 0
diff --git a/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go b/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go
index caca555..bbb09bf 100644
--- a/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/sub/b.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M2) ProtoReflect() protoreflect.Message {
- return xxx_File_import_public_sub_b_proto_messageTypes[0].MessageOf(m)
+func (x *M2) Reset() {
+ *x = M2{}
}
-func (m *M2) Reset() { *m = M2{} }
-func (m *M2) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M2) ProtoMessage() {}
+
+func (x *M2) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M2) ProtoMessage() {}
+
+func (x *M2) ProtoReflect() protoreflect.Message {
+ return xxx_File_import_public_sub_b_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M2.ProtoReflect.Type instead.
func (*M2) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go b/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go
index 7f936e1..be37da4 100644
--- a/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/sub2/a.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Sub2Message) ProtoReflect() protoreflect.Message {
- return xxx_File_import_public_sub2_a_proto_messageTypes[0].MessageOf(m)
+func (x *Sub2Message) Reset() {
+ *x = Sub2Message{}
}
-func (m *Sub2Message) Reset() { *m = Sub2Message{} }
-func (m *Sub2Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Sub2Message) ProtoMessage() {}
+
+func (x *Sub2Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Sub2Message) ProtoMessage() {}
+
+func (x *Sub2Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_import_public_sub2_a_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Sub2Message.ProtoReflect.Type instead.
func (*Sub2Message) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go b/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go
index 779c7e3..1ad7e8d 100644
--- a/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_fmt_m_proto_messageTypes[0].MessageOf(m)
+func (x *M) Reset() {
+ *x = M{}
}
-func (m *M) Reset() { *m = M{} }
-func (m *M) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M) ProtoMessage() {}
+
+func (x *M) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M) ProtoMessage() {}
+
+func (x *M) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_fmt_m_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M.ProtoReflect.Type instead.
func (*M) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
index c4efa6f..8f1cb2c 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
@@ -18,13 +18,6 @@
E1_E1_ZERO E1 = 0
)
-func (e E1) Type() protoreflect.EnumType {
- return xxx_File_imports_test_a_1_m1_proto_enumTypes[0]
-}
-func (e E1) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use E1.Type.Values instead.
var E1_name = map[int32]string{
0: "E1_ZERO",
@@ -39,6 +32,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (E1) Type() protoreflect.EnumType {
+ return xxx_File_imports_test_a_1_m1_proto_enumTypes[0]
+}
+
+func (x E1) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Use E1.Type instead.
func (E1) EnumDescriptor() ([]byte, []int) {
return xxx_File_imports_test_a_1_m1_proto_rawDescGZIP(), []int{0}
@@ -50,12 +51,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M1) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_a_1_m1_proto_messageTypes[0].MessageOf(m)
+func (x *M1) Reset() {
+ *x = M1{}
}
-func (m *M1) Reset() { *m = M1{} }
-func (m *M1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M1) ProtoMessage() {}
+
+func (x *M1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M1) ProtoMessage() {}
+
+func (x *M1) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_a_1_m1_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M1.ProtoReflect.Type instead.
func (*M1) Descriptor() ([]byte, []int) {
@@ -69,21 +77,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M1_1) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_a_1_m1_proto_messageTypes[1].MessageOf(m)
+func (x *M1_1) Reset() {
+ *x = M1_1{}
}
-func (m *M1_1) Reset() { *m = M1_1{} }
-func (m *M1_1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M1_1) ProtoMessage() {}
+
+func (x *M1_1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M1_1) ProtoMessage() {}
+
+func (x *M1_1) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_a_1_m1_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use M1_1.ProtoReflect.Type instead.
func (*M1_1) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_a_1_m1_proto_rawDescGZIP(), []int{1}
}
-func (m *M1_1) GetM1() *M1 {
- if m != nil {
- return m.M1
+func (x *M1_1) GetM1() *M1 {
+ if x != nil {
+ return x.M1
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go
index 70ab52d..f822333 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_a_1/m2.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M2) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_a_1_m2_proto_messageTypes[0].MessageOf(m)
+func (x *M2) Reset() {
+ *x = M2{}
}
-func (m *M2) Reset() { *m = M2{} }
-func (m *M2) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M2) ProtoMessage() {}
+
+func (x *M2) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M2) ProtoMessage() {}
+
+func (x *M2) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_a_1_m2_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M2.ProtoReflect.Type instead.
func (*M2) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go
index e1e05d0..9eda985 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_a_2/m3.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M3) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_a_2_m3_proto_messageTypes[0].MessageOf(m)
+func (x *M3) Reset() {
+ *x = M3{}
}
-func (m *M3) Reset() { *m = M3{} }
-func (m *M3) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M3) ProtoMessage() {}
+
+func (x *M3) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M3) ProtoMessage() {}
+
+func (x *M3) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_a_2_m3_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M3.ProtoReflect.Type instead.
func (*M3) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go b/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go
index 17a57ab..d9eb9d4 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_a_2/m4.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M4) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_a_2_m4_proto_messageTypes[0].MessageOf(m)
+func (x *M4) Reset() {
+ *x = M4{}
}
-func (m *M4) Reset() { *m = M4{} }
-func (m *M4) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M4) ProtoMessage() {}
+
+func (x *M4) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M4) ProtoMessage() {}
+
+func (x *M4) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_a_2_m4_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M4.ProtoReflect.Type instead.
func (*M4) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go b/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go
index 6ea825b..4f8f37e 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_b_1/m1.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M1) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_b_1_m1_proto_messageTypes[0].MessageOf(m)
+func (x *M1) Reset() {
+ *x = M1{}
}
-func (m *M1) Reset() { *m = M1{} }
-func (m *M1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M1) ProtoMessage() {}
+
+func (x *M1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M1) ProtoMessage() {}
+
+func (x *M1) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_b_1_m1_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M1.ProtoReflect.Type instead.
func (*M1) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go b/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go
index c4f866a..6da5dfb 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_b_1/m2.pb.go
@@ -18,12 +18,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *M2) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_b_1_m2_proto_messageTypes[0].MessageOf(m)
+func (x *M2) Reset() {
+ *x = M2{}
}
-func (m *M2) Reset() { *m = M2{} }
-func (m *M2) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*M2) ProtoMessage() {}
+
+func (x *M2) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*M2) ProtoMessage() {}
+
+func (x *M2) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_b_1_m2_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use M2.ProtoReflect.Type instead.
func (*M2) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go b/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go
index 552dc5a..3022393 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_import_a1m1.pb.go
@@ -20,21 +20,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *A1M1) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_import_a1m1_proto_messageTypes[0].MessageOf(m)
+func (x *A1M1) Reset() {
+ *x = A1M1{}
}
-func (m *A1M1) Reset() { *m = A1M1{} }
-func (m *A1M1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*A1M1) ProtoMessage() {}
+
+func (x *A1M1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*A1M1) ProtoMessage() {}
+
+func (x *A1M1) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_import_a1m1_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use A1M1.ProtoReflect.Type instead.
func (*A1M1) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_import_a1m1_proto_rawDescGZIP(), []int{0}
}
-func (m *A1M1) GetF() *test_a_1.M1 {
- if m != nil {
- return m.F
+func (x *A1M1) GetF() *test_a_1.M1 {
+ if x != nil {
+ return x.F
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go b/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go
index c0a0022..b2c5d85 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_import_a1m2.pb.go
@@ -20,21 +20,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *A1M2) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_import_a1m2_proto_messageTypes[0].MessageOf(m)
+func (x *A1M2) Reset() {
+ *x = A1M2{}
}
-func (m *A1M2) Reset() { *m = A1M2{} }
-func (m *A1M2) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*A1M2) ProtoMessage() {}
+
+func (x *A1M2) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*A1M2) ProtoMessage() {}
+
+func (x *A1M2) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_import_a1m2_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use A1M2.ProtoReflect.Type instead.
func (*A1M2) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_import_a1m2_proto_rawDescGZIP(), []int{0}
}
-func (m *A1M2) GetF() *test_a_1.M2 {
- if m != nil {
- return m.F
+func (x *A1M2) GetF() *test_a_1.M2 {
+ if x != nil {
+ return x.F
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go b/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go
index b2d6f9d..ff1fd2f 100644
--- a/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/test_import_all.pb.go
@@ -27,49 +27,56 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *All) ProtoReflect() protoreflect.Message {
- return xxx_File_imports_test_import_all_proto_messageTypes[0].MessageOf(m)
+func (x *All) Reset() {
+ *x = All{}
}
-func (m *All) Reset() { *m = All{} }
-func (m *All) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*All) ProtoMessage() {}
+
+func (x *All) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*All) ProtoMessage() {}
+
+func (x *All) ProtoReflect() protoreflect.Message {
+ return xxx_File_imports_test_import_all_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use All.ProtoReflect.Type instead.
func (*All) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_import_all_proto_rawDescGZIP(), []int{0}
}
-func (m *All) GetAm1() *test_a_1.M1 {
- if m != nil {
- return m.Am1
+func (x *All) GetAm1() *test_a_1.M1 {
+ if x != nil {
+ return x.Am1
}
return nil
}
-func (m *All) GetAm2() *test_a_1.M2 {
- if m != nil {
- return m.Am2
+func (x *All) GetAm2() *test_a_1.M2 {
+ if x != nil {
+ return x.Am2
}
return nil
}
-func (m *All) GetBm1() *test_b_1.M1 {
- if m != nil {
- return m.Bm1
+func (x *All) GetBm1() *test_b_1.M1 {
+ if x != nil {
+ return x.Bm1
}
return nil
}
-func (m *All) GetBm2() *test_b_1.M2 {
- if m != nil {
- return m.Bm2
+func (x *All) GetBm2() *test_b_1.M2 {
+ if x != nil {
+ return x.Bm2
}
return nil
}
-func (m *All) GetFmt() *fmt.M {
- if m != nil {
- return m.Fmt
+func (x *All) GetFmt() *fmt.M {
+ if x != nil {
+ return x.Fmt
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go b/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go
index 1ed2429..b2826bd 100644
--- a/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go
+++ b/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/test.pb.go
@@ -21,12 +21,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Foo) ProtoReflect() protoreflect.Message {
- return xxx_File_issue780_oneof_conflict_test_proto_messageTypes[0].MessageOf(m)
+func (x *Foo) Reset() {
+ *x = Foo{}
}
-func (m *Foo) Reset() { *m = Foo{} }
-func (m *Foo) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Foo) ProtoMessage() {}
+
+func (x *Foo) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Foo) ProtoMessage() {}
+
+func (x *Foo) ProtoReflect() protoreflect.Message {
+ return xxx_File_issue780_oneof_conflict_test_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Foo.ProtoReflect.Type instead.
func (*Foo) Descriptor() ([]byte, []int) {
@@ -50,8 +57,8 @@
return nil
}
-func (m *Foo) GetGetBar() string {
- if x, ok := m.GetBar().(*Foo_GetBar); ok {
+func (x *Foo) GetGetBar() string {
+ if x, ok := x.GetBar().(*Foo_GetBar); ok {
return x.GetBar
}
return ""
diff --git a/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go b/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
index 28669fb..829a1b6 100644
--- a/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
+++ b/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
@@ -18,13 +18,6 @@
Enum_ZERO Enum = 0
)
-func (e Enum) Type() protoreflect.EnumType {
- return xxx_File_nopackage_nopackage_proto_enumTypes[0]
-}
-func (e Enum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
@@ -43,6 +36,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (Enum) Type() protoreflect.EnumType {
+ return xxx_File_nopackage_nopackage_proto_enumTypes[0]
+}
+
+func (x Enum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *Enum) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -66,12 +67,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message) ProtoReflect() protoreflect.Message {
- return xxx_File_nopackage_nopackage_proto_messageTypes[0].MessageOf(m)
+func (x *Message) Reset() {
+ *x = Message{}
}
-func (m *Message) Reset() { *m = Message{} }
-func (m *Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message) ProtoMessage() {}
+
+func (x *Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message) ProtoMessage() {}
+
+func (x *Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_nopackage_nopackage_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
@@ -80,16 +88,16 @@
const Default_Message_EnumField Enum = Enum_ZERO
-func (m *Message) GetStringField() string {
- if m != nil && m.StringField != nil {
- return *m.StringField
+func (x *Message) GetStringField() string {
+ if x != nil && x.StringField != nil {
+ return *x.StringField
}
return ""
}
-func (m *Message) GetEnumField() Enum {
- if m != nil && m.EnumField != nil {
- return *m.EnumField
+func (x *Message) GetEnumField() Enum {
+ if x != nil && x.EnumField != nil {
+ return *x.EnumField
}
return Default_Message_EnumField
}
diff --git a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
index b1e534d..ca359dd 100644
--- a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
@@ -22,13 +22,6 @@
EnumType1_TWO EnumType1 = 2
)
-func (e EnumType1) Type() protoreflect.EnumType {
- return xxx_File_proto2_enum_proto_enumTypes[0]
-}
-func (e EnumType1) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use EnumType1.Type.Values instead.
var EnumType1_name = map[int32]string{
1: "ONE",
@@ -49,6 +42,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (EnumType1) Type() protoreflect.EnumType {
+ return xxx_File_proto2_enum_proto_enumTypes[0]
+}
+
+func (x EnumType1) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *EnumType1) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -71,13 +72,6 @@
EnumType2_duplicate2 EnumType2 = 1
)
-func (e EnumType2) Type() protoreflect.EnumType {
- return xxx_File_proto2_enum_proto_enumTypes[1]
-}
-func (e EnumType2) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use EnumType2.Type.Values instead.
var EnumType2_name = map[int32]string{
1: "duplicate1",
@@ -98,6 +92,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (EnumType2) Type() protoreflect.EnumType {
+ return xxx_File_proto2_enum_proto_enumTypes[1]
+}
+
+func (x EnumType2) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *EnumType2) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -121,13 +123,6 @@
EnumContainerMessage1_NESTED_1A_VALUE EnumContainerMessage1_NestedEnumType1A = 0
)
-func (e EnumContainerMessage1_NestedEnumType1A) Type() protoreflect.EnumType {
- return xxx_File_proto2_enum_proto_enumTypes[2]
-}
-func (e EnumContainerMessage1_NestedEnumType1A) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use EnumContainerMessage1_NestedEnumType1A.Type.Values instead.
var EnumContainerMessage1_NestedEnumType1A_name = map[int32]string{
0: "NESTED_1A_VALUE",
@@ -146,6 +141,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (EnumContainerMessage1_NestedEnumType1A) Type() protoreflect.EnumType {
+ return xxx_File_proto2_enum_proto_enumTypes[2]
+}
+
+func (x EnumContainerMessage1_NestedEnumType1A) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *EnumContainerMessage1_NestedEnumType1A) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -167,13 +170,6 @@
EnumContainerMessage1_NESTED_1B_VALUE EnumContainerMessage1_NestedEnumType1B = 0
)
-func (e EnumContainerMessage1_NestedEnumType1B) Type() protoreflect.EnumType {
- return xxx_File_proto2_enum_proto_enumTypes[3]
-}
-func (e EnumContainerMessage1_NestedEnumType1B) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use EnumContainerMessage1_NestedEnumType1B.Type.Values instead.
var EnumContainerMessage1_NestedEnumType1B_name = map[int32]string{
0: "NESTED_1B_VALUE",
@@ -192,6 +188,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (EnumContainerMessage1_NestedEnumType1B) Type() protoreflect.EnumType {
+ return xxx_File_proto2_enum_proto_enumTypes[3]
+}
+
+func (x EnumContainerMessage1_NestedEnumType1B) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *EnumContainerMessage1_NestedEnumType1B) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -215,13 +219,6 @@
EnumContainerMessage1_EnumContainerMessage2_NESTED_2A_VALUE EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A = 0
)
-func (e EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) Type() protoreflect.EnumType {
- return xxx_File_proto2_enum_proto_enumTypes[4]
-}
-func (e EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A.Type.Values instead.
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_name = map[int32]string{
0: "NESTED_2A_VALUE",
@@ -240,6 +237,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) Type() protoreflect.EnumType {
+ return xxx_File_proto2_enum_proto_enumTypes[4]
+}
+
+func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -261,13 +266,6 @@
EnumContainerMessage1_EnumContainerMessage2_NESTED_2B_VALUE EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B = 0
)
-func (e EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) Type() protoreflect.EnumType {
- return xxx_File_proto2_enum_proto_enumTypes[5]
-}
-func (e EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B.Type.Values instead.
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_name = map[int32]string{
0: "NESTED_2B_VALUE",
@@ -286,6 +284,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) Type() protoreflect.EnumType {
+ return xxx_File_proto2_enum_proto_enumTypes[5]
+}
+
+func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -309,12 +315,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *EnumContainerMessage1) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_enum_proto_messageTypes[0].MessageOf(m)
+func (x *EnumContainerMessage1) Reset() {
+ *x = EnumContainerMessage1{}
}
-func (m *EnumContainerMessage1) Reset() { *m = EnumContainerMessage1{} }
-func (m *EnumContainerMessage1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*EnumContainerMessage1) ProtoMessage() {}
+
+func (x *EnumContainerMessage1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EnumContainerMessage1) ProtoMessage() {}
+
+func (x *EnumContainerMessage1) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_enum_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use EnumContainerMessage1.ProtoReflect.Type instead.
func (*EnumContainerMessage1) Descriptor() ([]byte, []int) {
@@ -324,16 +337,16 @@
const Default_EnumContainerMessage1_DefaultDuplicate1 EnumType2 = EnumType2_duplicate1
const Default_EnumContainerMessage1_DefaultDuplicate2 EnumType2 = EnumType2_duplicate2
-func (m *EnumContainerMessage1) GetDefaultDuplicate1() EnumType2 {
- if m != nil && m.DefaultDuplicate1 != nil {
- return *m.DefaultDuplicate1
+func (x *EnumContainerMessage1) GetDefaultDuplicate1() EnumType2 {
+ if x != nil && x.DefaultDuplicate1 != nil {
+ return *x.DefaultDuplicate1
}
return Default_EnumContainerMessage1_DefaultDuplicate1
}
-func (m *EnumContainerMessage1) GetDefaultDuplicate2() EnumType2 {
- if m != nil && m.DefaultDuplicate2 != nil {
- return *m.DefaultDuplicate2
+func (x *EnumContainerMessage1) GetDefaultDuplicate2() EnumType2 {
+ if x != nil && x.DefaultDuplicate2 != nil {
+ return *x.DefaultDuplicate2
}
return Default_EnumContainerMessage1_DefaultDuplicate2
}
@@ -344,17 +357,20 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *EnumContainerMessage1_EnumContainerMessage2) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_enum_proto_messageTypes[1].MessageOf(m)
+func (x *EnumContainerMessage1_EnumContainerMessage2) Reset() {
+ *x = EnumContainerMessage1_EnumContainerMessage2{}
}
-func (m *EnumContainerMessage1_EnumContainerMessage2) Reset() {
- *m = EnumContainerMessage1_EnumContainerMessage2{}
+
+func (x *EnumContainerMessage1_EnumContainerMessage2) String() string {
+ return protoimpl.X.MessageStringOf(x)
}
-func (m *EnumContainerMessage1_EnumContainerMessage2) String() string {
- return protoimpl.X.MessageStringOf(m)
-}
+
func (*EnumContainerMessage1_EnumContainerMessage2) ProtoMessage() {}
+func (x *EnumContainerMessage1_EnumContainerMessage2) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_enum_proto_messageTypes[1].MessageOf(x)
+}
+
// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2.ProtoReflect.Type instead.
func (*EnumContainerMessage1_EnumContainerMessage2) Descriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawDescGZIP(), []int{0, 0}
diff --git a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
index d37f28c..da2f13a 100644
--- a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
@@ -20,13 +20,6 @@
FieldTestMessage_ONE FieldTestMessage_Enum = 1
)
-func (e FieldTestMessage_Enum) Type() protoreflect.EnumType {
- return xxx_File_proto2_fields_proto_enumTypes[0]
-}
-func (e FieldTestMessage_Enum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use FieldTestMessage_Enum.Type.Values instead.
var FieldTestMessage_Enum_name = map[int32]string{
0: "ZERO",
@@ -47,6 +40,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (FieldTestMessage_Enum) Type() protoreflect.EnumType {
+ return xxx_File_proto2_fields_proto_enumTypes[0]
+}
+
+func (x FieldTestMessage_Enum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Do not use.
func (x *FieldTestMessage_Enum) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
@@ -174,12 +175,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_fields_proto_messageTypes[0].MessageOf(m)
+func (x *FieldTestMessage) Reset() {
+ *x = FieldTestMessage{}
}
-func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
-func (m *FieldTestMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage) ProtoMessage() {}
+
+func (x *FieldTestMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage) ProtoMessage() {}
+
+func (x *FieldTestMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_fields_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage.ProtoReflect.Type instead.
func (*FieldTestMessage) Descriptor() ([]byte, []int) {
@@ -214,569 +222,569 @@
var Default_FieldTestMessage_DefaultDoublePosinf float64 = math.Inf(1)
var Default_FieldTestMessage_DefaultDoubleNan float64 = math.NaN()
-func (m *FieldTestMessage) GetOptionalBool() bool {
- if m != nil && m.OptionalBool != nil {
- return *m.OptionalBool
+func (x *FieldTestMessage) GetOptionalBool() bool {
+ if x != nil && x.OptionalBool != nil {
+ return *x.OptionalBool
}
return false
}
-func (m *FieldTestMessage) GetOptionalEnum() FieldTestMessage_Enum {
- if m != nil && m.OptionalEnum != nil {
- return *m.OptionalEnum
+func (x *FieldTestMessage) GetOptionalEnum() FieldTestMessage_Enum {
+ if x != nil && x.OptionalEnum != nil {
+ return *x.OptionalEnum
}
return FieldTestMessage_ZERO
}
-func (m *FieldTestMessage) GetOptionalInt32() int32 {
- if m != nil && m.OptionalInt32 != nil {
- return *m.OptionalInt32
+func (x *FieldTestMessage) GetOptionalInt32() int32 {
+ if x != nil && x.OptionalInt32 != nil {
+ return *x.OptionalInt32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSint32() int32 {
- if m != nil && m.OptionalSint32 != nil {
- return *m.OptionalSint32
+func (x *FieldTestMessage) GetOptionalSint32() int32 {
+ if x != nil && x.OptionalSint32 != nil {
+ return *x.OptionalSint32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalUint32() uint32 {
- if m != nil && m.OptionalUint32 != nil {
- return *m.OptionalUint32
+func (x *FieldTestMessage) GetOptionalUint32() uint32 {
+ if x != nil && x.OptionalUint32 != nil {
+ return *x.OptionalUint32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalInt64() int64 {
- if m != nil && m.OptionalInt64 != nil {
- return *m.OptionalInt64
+func (x *FieldTestMessage) GetOptionalInt64() int64 {
+ if x != nil && x.OptionalInt64 != nil {
+ return *x.OptionalInt64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSint64() int64 {
- if m != nil && m.OptionalSint64 != nil {
- return *m.OptionalSint64
+func (x *FieldTestMessage) GetOptionalSint64() int64 {
+ if x != nil && x.OptionalSint64 != nil {
+ return *x.OptionalSint64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalUint64() uint64 {
- if m != nil && m.OptionalUint64 != nil {
- return *m.OptionalUint64
+func (x *FieldTestMessage) GetOptionalUint64() uint64 {
+ if x != nil && x.OptionalUint64 != nil {
+ return *x.OptionalUint64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSfixed32() int32 {
- if m != nil && m.OptionalSfixed32 != nil {
- return *m.OptionalSfixed32
+func (x *FieldTestMessage) GetOptionalSfixed32() int32 {
+ if x != nil && x.OptionalSfixed32 != nil {
+ return *x.OptionalSfixed32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalFixed32() uint32 {
- if m != nil && m.OptionalFixed32 != nil {
- return *m.OptionalFixed32
+func (x *FieldTestMessage) GetOptionalFixed32() uint32 {
+ if x != nil && x.OptionalFixed32 != nil {
+ return *x.OptionalFixed32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalFloat() float32 {
- if m != nil && m.OptionalFloat != nil {
- return *m.OptionalFloat
+func (x *FieldTestMessage) GetOptionalFloat() float32 {
+ if x != nil && x.OptionalFloat != nil {
+ return *x.OptionalFloat
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSfixed64() int64 {
- if m != nil && m.OptionalSfixed64 != nil {
- return *m.OptionalSfixed64
+func (x *FieldTestMessage) GetOptionalSfixed64() int64 {
+ if x != nil && x.OptionalSfixed64 != nil {
+ return *x.OptionalSfixed64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalFixed64() uint64 {
- if m != nil && m.OptionalFixed64 != nil {
- return *m.OptionalFixed64
+func (x *FieldTestMessage) GetOptionalFixed64() uint64 {
+ if x != nil && x.OptionalFixed64 != nil {
+ return *x.OptionalFixed64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalDouble() float64 {
- if m != nil && m.OptionalDouble != nil {
- return *m.OptionalDouble
+func (x *FieldTestMessage) GetOptionalDouble() float64 {
+ if x != nil && x.OptionalDouble != nil {
+ return *x.OptionalDouble
}
return 0
}
-func (m *FieldTestMessage) GetOptionalString() string {
- if m != nil && m.OptionalString != nil {
- return *m.OptionalString
+func (x *FieldTestMessage) GetOptionalString() string {
+ if x != nil && x.OptionalString != nil {
+ return *x.OptionalString
}
return ""
}
-func (m *FieldTestMessage) GetOptionalBytes() []byte {
- if m != nil {
- return m.OptionalBytes
+func (x *FieldTestMessage) GetOptionalBytes() []byte {
+ if x != nil {
+ return x.OptionalBytes
}
return nil
}
-func (m *FieldTestMessage) GetOptional_Message() *FieldTestMessage_Message {
- if m != nil {
- return m.Optional_Message
+func (x *FieldTestMessage) GetOptional_Message() *FieldTestMessage_Message {
+ if x != nil {
+ return x.Optional_Message
}
return nil
}
-func (m *FieldTestMessage) GetOptionalgroup() *FieldTestMessage_OptionalGroup {
- if m != nil {
- return m.Optionalgroup
+func (x *FieldTestMessage) GetOptionalgroup() *FieldTestMessage_OptionalGroup {
+ if x != nil {
+ return x.Optionalgroup
}
return nil
}
-func (m *FieldTestMessage) GetRequiredBool() bool {
- if m != nil && m.RequiredBool != nil {
- return *m.RequiredBool
+func (x *FieldTestMessage) GetRequiredBool() bool {
+ if x != nil && x.RequiredBool != nil {
+ return *x.RequiredBool
}
return false
}
-func (m *FieldTestMessage) GetRequiredEnum() FieldTestMessage_Enum {
- if m != nil && m.RequiredEnum != nil {
- return *m.RequiredEnum
+func (x *FieldTestMessage) GetRequiredEnum() FieldTestMessage_Enum {
+ if x != nil && x.RequiredEnum != nil {
+ return *x.RequiredEnum
}
return FieldTestMessage_ZERO
}
-func (m *FieldTestMessage) GetRequiredInt32() int32 {
- if m != nil && m.RequiredInt32 != nil {
- return *m.RequiredInt32
+func (x *FieldTestMessage) GetRequiredInt32() int32 {
+ if x != nil && x.RequiredInt32 != nil {
+ return *x.RequiredInt32
}
return 0
}
-func (m *FieldTestMessage) GetRequiredSint32() int32 {
- if m != nil && m.RequiredSint32 != nil {
- return *m.RequiredSint32
+func (x *FieldTestMessage) GetRequiredSint32() int32 {
+ if x != nil && x.RequiredSint32 != nil {
+ return *x.RequiredSint32
}
return 0
}
-func (m *FieldTestMessage) GetRequiredUint32() uint32 {
- if m != nil && m.RequiredUint32 != nil {
- return *m.RequiredUint32
+func (x *FieldTestMessage) GetRequiredUint32() uint32 {
+ if x != nil && x.RequiredUint32 != nil {
+ return *x.RequiredUint32
}
return 0
}
-func (m *FieldTestMessage) GetRequiredInt64() int64 {
- if m != nil && m.RequiredInt64 != nil {
- return *m.RequiredInt64
+func (x *FieldTestMessage) GetRequiredInt64() int64 {
+ if x != nil && x.RequiredInt64 != nil {
+ return *x.RequiredInt64
}
return 0
}
-func (m *FieldTestMessage) GetRequiredSint64() int64 {
- if m != nil && m.RequiredSint64 != nil {
- return *m.RequiredSint64
+func (x *FieldTestMessage) GetRequiredSint64() int64 {
+ if x != nil && x.RequiredSint64 != nil {
+ return *x.RequiredSint64
}
return 0
}
-func (m *FieldTestMessage) GetRequiredUint64() uint64 {
- if m != nil && m.RequiredUint64 != nil {
- return *m.RequiredUint64
+func (x *FieldTestMessage) GetRequiredUint64() uint64 {
+ if x != nil && x.RequiredUint64 != nil {
+ return *x.RequiredUint64
}
return 0
}
-func (m *FieldTestMessage) GetRequiredSfixed32() int32 {
- if m != nil && m.RequiredSfixed32 != nil {
- return *m.RequiredSfixed32
+func (x *FieldTestMessage) GetRequiredSfixed32() int32 {
+ if x != nil && x.RequiredSfixed32 != nil {
+ return *x.RequiredSfixed32
}
return 0
}
-func (m *FieldTestMessage) GetRequiredFixed32() uint32 {
- if m != nil && m.RequiredFixed32 != nil {
- return *m.RequiredFixed32
+func (x *FieldTestMessage) GetRequiredFixed32() uint32 {
+ if x != nil && x.RequiredFixed32 != nil {
+ return *x.RequiredFixed32
}
return 0
}
-func (m *FieldTestMessage) GetRequiredFloat() float32 {
- if m != nil && m.RequiredFloat != nil {
- return *m.RequiredFloat
+func (x *FieldTestMessage) GetRequiredFloat() float32 {
+ if x != nil && x.RequiredFloat != nil {
+ return *x.RequiredFloat
}
return 0
}
-func (m *FieldTestMessage) GetRequiredSfixed64() int64 {
- if m != nil && m.RequiredSfixed64 != nil {
- return *m.RequiredSfixed64
+func (x *FieldTestMessage) GetRequiredSfixed64() int64 {
+ if x != nil && x.RequiredSfixed64 != nil {
+ return *x.RequiredSfixed64
}
return 0
}
-func (m *FieldTestMessage) GetRequiredFixed64() uint64 {
- if m != nil && m.RequiredFixed64 != nil {
- return *m.RequiredFixed64
+func (x *FieldTestMessage) GetRequiredFixed64() uint64 {
+ if x != nil && x.RequiredFixed64 != nil {
+ return *x.RequiredFixed64
}
return 0
}
-func (m *FieldTestMessage) GetRequiredDouble() float64 {
- if m != nil && m.RequiredDouble != nil {
- return *m.RequiredDouble
+func (x *FieldTestMessage) GetRequiredDouble() float64 {
+ if x != nil && x.RequiredDouble != nil {
+ return *x.RequiredDouble
}
return 0
}
-func (m *FieldTestMessage) GetRequiredString() string {
- if m != nil && m.RequiredString != nil {
- return *m.RequiredString
+func (x *FieldTestMessage) GetRequiredString() string {
+ if x != nil && x.RequiredString != nil {
+ return *x.RequiredString
}
return ""
}
-func (m *FieldTestMessage) GetRequiredBytes() []byte {
- if m != nil {
- return m.RequiredBytes
+func (x *FieldTestMessage) GetRequiredBytes() []byte {
+ if x != nil {
+ return x.RequiredBytes
}
return nil
}
-func (m *FieldTestMessage) GetRequired_Message() *FieldTestMessage_Message {
- if m != nil {
- return m.Required_Message
+func (x *FieldTestMessage) GetRequired_Message() *FieldTestMessage_Message {
+ if x != nil {
+ return x.Required_Message
}
return nil
}
-func (m *FieldTestMessage) GetRequiredgroup() *FieldTestMessage_RequiredGroup {
- if m != nil {
- return m.Requiredgroup
+func (x *FieldTestMessage) GetRequiredgroup() *FieldTestMessage_RequiredGroup {
+ if x != nil {
+ return x.Requiredgroup
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedBool() []bool {
- if m != nil {
- return m.RepeatedBool
+func (x *FieldTestMessage) GetRepeatedBool() []bool {
+ if x != nil {
+ return x.RepeatedBool
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedEnum() []FieldTestMessage_Enum {
- if m != nil {
- return m.RepeatedEnum
+func (x *FieldTestMessage) GetRepeatedEnum() []FieldTestMessage_Enum {
+ if x != nil {
+ return x.RepeatedEnum
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedInt32() []int32 {
- if m != nil {
- return m.RepeatedInt32
+func (x *FieldTestMessage) GetRepeatedInt32() []int32 {
+ if x != nil {
+ return x.RepeatedInt32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSint32() []int32 {
- if m != nil {
- return m.RepeatedSint32
+func (x *FieldTestMessage) GetRepeatedSint32() []int32 {
+ if x != nil {
+ return x.RepeatedSint32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedUint32() []uint32 {
- if m != nil {
- return m.RepeatedUint32
+func (x *FieldTestMessage) GetRepeatedUint32() []uint32 {
+ if x != nil {
+ return x.RepeatedUint32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedInt64() []int64 {
- if m != nil {
- return m.RepeatedInt64
+func (x *FieldTestMessage) GetRepeatedInt64() []int64 {
+ if x != nil {
+ return x.RepeatedInt64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSint64() []int64 {
- if m != nil {
- return m.RepeatedSint64
+func (x *FieldTestMessage) GetRepeatedSint64() []int64 {
+ if x != nil {
+ return x.RepeatedSint64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedUint64() []uint64 {
- if m != nil {
- return m.RepeatedUint64
+func (x *FieldTestMessage) GetRepeatedUint64() []uint64 {
+ if x != nil {
+ return x.RepeatedUint64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSfixed32() []int32 {
- if m != nil {
- return m.RepeatedSfixed32
+func (x *FieldTestMessage) GetRepeatedSfixed32() []int32 {
+ if x != nil {
+ return x.RepeatedSfixed32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedFixed32() []uint32 {
- if m != nil {
- return m.RepeatedFixed32
+func (x *FieldTestMessage) GetRepeatedFixed32() []uint32 {
+ if x != nil {
+ return x.RepeatedFixed32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedFloat() []float32 {
- if m != nil {
- return m.RepeatedFloat
+func (x *FieldTestMessage) GetRepeatedFloat() []float32 {
+ if x != nil {
+ return x.RepeatedFloat
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSfixed64() []int64 {
- if m != nil {
- return m.RepeatedSfixed64
+func (x *FieldTestMessage) GetRepeatedSfixed64() []int64 {
+ if x != nil {
+ return x.RepeatedSfixed64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedFixed64() []uint64 {
- if m != nil {
- return m.RepeatedFixed64
+func (x *FieldTestMessage) GetRepeatedFixed64() []uint64 {
+ if x != nil {
+ return x.RepeatedFixed64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedDouble() []float64 {
- if m != nil {
- return m.RepeatedDouble
+func (x *FieldTestMessage) GetRepeatedDouble() []float64 {
+ if x != nil {
+ return x.RepeatedDouble
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedString() []string {
- if m != nil {
- return m.RepeatedString
+func (x *FieldTestMessage) GetRepeatedString() []string {
+ if x != nil {
+ return x.RepeatedString
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedBytes() [][]byte {
- if m != nil {
- return m.RepeatedBytes
+func (x *FieldTestMessage) GetRepeatedBytes() [][]byte {
+ if x != nil {
+ return x.RepeatedBytes
}
return nil
}
-func (m *FieldTestMessage) GetRepeated_Message() []*FieldTestMessage_Message {
- if m != nil {
- return m.Repeated_Message
+func (x *FieldTestMessage) GetRepeated_Message() []*FieldTestMessage_Message {
+ if x != nil {
+ return x.Repeated_Message
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedgroup() []*FieldTestMessage_RepeatedGroup {
- if m != nil {
- return m.Repeatedgroup
+func (x *FieldTestMessage) GetRepeatedgroup() []*FieldTestMessage_RepeatedGroup {
+ if x != nil {
+ return x.Repeatedgroup
}
return nil
}
-func (m *FieldTestMessage) GetDefaultBool() bool {
- if m != nil && m.DefaultBool != nil {
- return *m.DefaultBool
+func (x *FieldTestMessage) GetDefaultBool() bool {
+ if x != nil && x.DefaultBool != nil {
+ return *x.DefaultBool
}
return Default_FieldTestMessage_DefaultBool
}
-func (m *FieldTestMessage) GetDefaultEnum() FieldTestMessage_Enum {
- if m != nil && m.DefaultEnum != nil {
- return *m.DefaultEnum
+func (x *FieldTestMessage) GetDefaultEnum() FieldTestMessage_Enum {
+ if x != nil && x.DefaultEnum != nil {
+ return *x.DefaultEnum
}
return Default_FieldTestMessage_DefaultEnum
}
-func (m *FieldTestMessage) GetDefaultInt32() int32 {
- if m != nil && m.DefaultInt32 != nil {
- return *m.DefaultInt32
+func (x *FieldTestMessage) GetDefaultInt32() int32 {
+ if x != nil && x.DefaultInt32 != nil {
+ return *x.DefaultInt32
}
return Default_FieldTestMessage_DefaultInt32
}
-func (m *FieldTestMessage) GetDefaultSint32() int32 {
- if m != nil && m.DefaultSint32 != nil {
- return *m.DefaultSint32
+func (x *FieldTestMessage) GetDefaultSint32() int32 {
+ if x != nil && x.DefaultSint32 != nil {
+ return *x.DefaultSint32
}
return Default_FieldTestMessage_DefaultSint32
}
-func (m *FieldTestMessage) GetDefaultUint32() uint32 {
- if m != nil && m.DefaultUint32 != nil {
- return *m.DefaultUint32
+func (x *FieldTestMessage) GetDefaultUint32() uint32 {
+ if x != nil && x.DefaultUint32 != nil {
+ return *x.DefaultUint32
}
return Default_FieldTestMessage_DefaultUint32
}
-func (m *FieldTestMessage) GetDefaultInt64() int64 {
- if m != nil && m.DefaultInt64 != nil {
- return *m.DefaultInt64
+func (x *FieldTestMessage) GetDefaultInt64() int64 {
+ if x != nil && x.DefaultInt64 != nil {
+ return *x.DefaultInt64
}
return Default_FieldTestMessage_DefaultInt64
}
-func (m *FieldTestMessage) GetDefaultSint64() int64 {
- if m != nil && m.DefaultSint64 != nil {
- return *m.DefaultSint64
+func (x *FieldTestMessage) GetDefaultSint64() int64 {
+ if x != nil && x.DefaultSint64 != nil {
+ return *x.DefaultSint64
}
return Default_FieldTestMessage_DefaultSint64
}
-func (m *FieldTestMessage) GetDefaultUint64() uint64 {
- if m != nil && m.DefaultUint64 != nil {
- return *m.DefaultUint64
+func (x *FieldTestMessage) GetDefaultUint64() uint64 {
+ if x != nil && x.DefaultUint64 != nil {
+ return *x.DefaultUint64
}
return Default_FieldTestMessage_DefaultUint64
}
-func (m *FieldTestMessage) GetDefaultSfixed32() int32 {
- if m != nil && m.DefaultSfixed32 != nil {
- return *m.DefaultSfixed32
+func (x *FieldTestMessage) GetDefaultSfixed32() int32 {
+ if x != nil && x.DefaultSfixed32 != nil {
+ return *x.DefaultSfixed32
}
return Default_FieldTestMessage_DefaultSfixed32
}
-func (m *FieldTestMessage) GetDefaultFixed32() uint32 {
- if m != nil && m.DefaultFixed32 != nil {
- return *m.DefaultFixed32
+func (x *FieldTestMessage) GetDefaultFixed32() uint32 {
+ if x != nil && x.DefaultFixed32 != nil {
+ return *x.DefaultFixed32
}
return Default_FieldTestMessage_DefaultFixed32
}
-func (m *FieldTestMessage) GetDefaultFloat() float32 {
- if m != nil && m.DefaultFloat != nil {
- return *m.DefaultFloat
+func (x *FieldTestMessage) GetDefaultFloat() float32 {
+ if x != nil && x.DefaultFloat != nil {
+ return *x.DefaultFloat
}
return Default_FieldTestMessage_DefaultFloat
}
-func (m *FieldTestMessage) GetDefaultSfixed64() int64 {
- if m != nil && m.DefaultSfixed64 != nil {
- return *m.DefaultSfixed64
+func (x *FieldTestMessage) GetDefaultSfixed64() int64 {
+ if x != nil && x.DefaultSfixed64 != nil {
+ return *x.DefaultSfixed64
}
return Default_FieldTestMessage_DefaultSfixed64
}
-func (m *FieldTestMessage) GetDefaultFixed64() uint64 {
- if m != nil && m.DefaultFixed64 != nil {
- return *m.DefaultFixed64
+func (x *FieldTestMessage) GetDefaultFixed64() uint64 {
+ if x != nil && x.DefaultFixed64 != nil {
+ return *x.DefaultFixed64
}
return Default_FieldTestMessage_DefaultFixed64
}
-func (m *FieldTestMessage) GetDefaultDouble() float64 {
- if m != nil && m.DefaultDouble != nil {
- return *m.DefaultDouble
+func (x *FieldTestMessage) GetDefaultDouble() float64 {
+ if x != nil && x.DefaultDouble != nil {
+ return *x.DefaultDouble
}
return Default_FieldTestMessage_DefaultDouble
}
-func (m *FieldTestMessage) GetDefaultString() string {
- if m != nil && m.DefaultString != nil {
- return *m.DefaultString
+func (x *FieldTestMessage) GetDefaultString() string {
+ if x != nil && x.DefaultString != nil {
+ return *x.DefaultString
}
return Default_FieldTestMessage_DefaultString
}
-func (m *FieldTestMessage) GetDefaultBytes() []byte {
- if m != nil && m.DefaultBytes != nil {
- return m.DefaultBytes
+func (x *FieldTestMessage) GetDefaultBytes() []byte {
+ if x != nil && x.DefaultBytes != nil {
+ return x.DefaultBytes
}
return append([]byte(nil), Default_FieldTestMessage_DefaultBytes...)
}
-func (m *FieldTestMessage) GetDefaultZeroString() string {
- if m != nil && m.DefaultZeroString != nil {
- return *m.DefaultZeroString
+func (x *FieldTestMessage) GetDefaultZeroString() string {
+ if x != nil && x.DefaultZeroString != nil {
+ return *x.DefaultZeroString
}
return Default_FieldTestMessage_DefaultZeroString
}
-func (m *FieldTestMessage) GetDefaultZeroBytes() []byte {
- if m != nil && m.DefaultZeroBytes != nil {
- return m.DefaultZeroBytes
+func (x *FieldTestMessage) GetDefaultZeroBytes() []byte {
+ if x != nil && x.DefaultZeroBytes != nil {
+ return x.DefaultZeroBytes
}
return append([]byte(nil), Default_FieldTestMessage_DefaultZeroBytes...)
}
-func (m *FieldTestMessage) GetDefaultFloatNeginf() float32 {
- if m != nil && m.DefaultFloatNeginf != nil {
- return *m.DefaultFloatNeginf
+func (x *FieldTestMessage) GetDefaultFloatNeginf() float32 {
+ if x != nil && x.DefaultFloatNeginf != nil {
+ return *x.DefaultFloatNeginf
}
return Default_FieldTestMessage_DefaultFloatNeginf
}
-func (m *FieldTestMessage) GetDefaultFloatPosinf() float32 {
- if m != nil && m.DefaultFloatPosinf != nil {
- return *m.DefaultFloatPosinf
+func (x *FieldTestMessage) GetDefaultFloatPosinf() float32 {
+ if x != nil && x.DefaultFloatPosinf != nil {
+ return *x.DefaultFloatPosinf
}
return Default_FieldTestMessage_DefaultFloatPosinf
}
-func (m *FieldTestMessage) GetDefaultFloatNan() float32 {
- if m != nil && m.DefaultFloatNan != nil {
- return *m.DefaultFloatNan
+func (x *FieldTestMessage) GetDefaultFloatNan() float32 {
+ if x != nil && x.DefaultFloatNan != nil {
+ return *x.DefaultFloatNan
}
return Default_FieldTestMessage_DefaultFloatNan
}
-func (m *FieldTestMessage) GetDefaultDoubleNeginf() float64 {
- if m != nil && m.DefaultDoubleNeginf != nil {
- return *m.DefaultDoubleNeginf
+func (x *FieldTestMessage) GetDefaultDoubleNeginf() float64 {
+ if x != nil && x.DefaultDoubleNeginf != nil {
+ return *x.DefaultDoubleNeginf
}
return Default_FieldTestMessage_DefaultDoubleNeginf
}
-func (m *FieldTestMessage) GetDefaultDoublePosinf() float64 {
- if m != nil && m.DefaultDoublePosinf != nil {
- return *m.DefaultDoublePosinf
+func (x *FieldTestMessage) GetDefaultDoublePosinf() float64 {
+ if x != nil && x.DefaultDoublePosinf != nil {
+ return *x.DefaultDoublePosinf
}
return Default_FieldTestMessage_DefaultDoublePosinf
}
-func (m *FieldTestMessage) GetDefaultDoubleNan() float64 {
- if m != nil && m.DefaultDoubleNan != nil {
- return *m.DefaultDoubleNan
+func (x *FieldTestMessage) GetDefaultDoubleNan() float64 {
+ if x != nil && x.DefaultDoubleNan != nil {
+ return *x.DefaultDoubleNan
}
return Default_FieldTestMessage_DefaultDoubleNan
}
-func (m *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
- if m != nil {
- return m.MapInt32Int64
+func (x *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
+ if x != nil {
+ return x.MapInt32Int64
}
return nil
}
-func (m *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
- if m != nil {
- return m.MapStringMessage
+func (x *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
+ if x != nil {
+ return x.MapStringMessage
}
return nil
}
-func (m *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
- if m != nil {
- return m.MapFixed64Enum
+func (x *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
+ if x != nil {
+ return x.MapFixed64Enum
}
return nil
}
@@ -906,134 +914,134 @@
return nil
}
-func (m *FieldTestMessage) GetOneofBool() bool {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofBool); ok {
+func (x *FieldTestMessage) GetOneofBool() bool {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofBool); ok {
return x.OneofBool
}
return false
}
-func (m *FieldTestMessage) GetOneofEnum() FieldTestMessage_Enum {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofEnum); ok {
+func (x *FieldTestMessage) GetOneofEnum() FieldTestMessage_Enum {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofEnum); ok {
return x.OneofEnum
}
return FieldTestMessage_ZERO
}
-func (m *FieldTestMessage) GetOneofInt32() int32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofInt32); ok {
+func (x *FieldTestMessage) GetOneofInt32() int32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofInt32); ok {
return x.OneofInt32
}
return 0
}
-func (m *FieldTestMessage) GetOneofSint32() int32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofSint32); ok {
+func (x *FieldTestMessage) GetOneofSint32() int32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofSint32); ok {
return x.OneofSint32
}
return 0
}
-func (m *FieldTestMessage) GetOneofUint32() uint32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofUint32); ok {
+func (x *FieldTestMessage) GetOneofUint32() uint32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofUint32); ok {
return x.OneofUint32
}
return 0
}
-func (m *FieldTestMessage) GetOneofInt64() int64 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofInt64); ok {
+func (x *FieldTestMessage) GetOneofInt64() int64 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofInt64); ok {
return x.OneofInt64
}
return 0
}
-func (m *FieldTestMessage) GetOneofSint64() int64 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofSint64); ok {
+func (x *FieldTestMessage) GetOneofSint64() int64 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofSint64); ok {
return x.OneofSint64
}
return 0
}
-func (m *FieldTestMessage) GetOneofUint64() uint64 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofUint64); ok {
+func (x *FieldTestMessage) GetOneofUint64() uint64 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofUint64); ok {
return x.OneofUint64
}
return 0
}
-func (m *FieldTestMessage) GetOneofSfixed32() int32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofSfixed32); ok {
+func (x *FieldTestMessage) GetOneofSfixed32() int32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofSfixed32); ok {
return x.OneofSfixed32
}
return 0
}
-func (m *FieldTestMessage) GetOneofFixed32() uint32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofFixed32); ok {
+func (x *FieldTestMessage) GetOneofFixed32() uint32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofFixed32); ok {
return x.OneofFixed32
}
return 0
}
-func (m *FieldTestMessage) GetOneofFloat() float32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofFloat); ok {
+func (x *FieldTestMessage) GetOneofFloat() float32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofFloat); ok {
return x.OneofFloat
}
return 0
}
-func (m *FieldTestMessage) GetOneofSfixed64() int64 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofSfixed64); ok {
+func (x *FieldTestMessage) GetOneofSfixed64() int64 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofSfixed64); ok {
return x.OneofSfixed64
}
return 0
}
-func (m *FieldTestMessage) GetOneofFixed64() uint64 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofFixed64); ok {
+func (x *FieldTestMessage) GetOneofFixed64() uint64 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofFixed64); ok {
return x.OneofFixed64
}
return 0
}
-func (m *FieldTestMessage) GetOneofDouble() float64 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofDouble); ok {
+func (x *FieldTestMessage) GetOneofDouble() float64 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofDouble); ok {
return x.OneofDouble
}
return 0
}
-func (m *FieldTestMessage) GetOneofString() string {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofString); ok {
+func (x *FieldTestMessage) GetOneofString() string {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofString); ok {
return x.OneofString
}
return ""
}
-func (m *FieldTestMessage) GetOneofBytes() []byte {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofBytes); ok {
+func (x *FieldTestMessage) GetOneofBytes() []byte {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofBytes); ok {
return x.OneofBytes
}
return nil
}
-func (m *FieldTestMessage) GetOneof_Message() *FieldTestMessage_Message {
- if x, ok := m.GetOneofField().(*FieldTestMessage_Oneof_Message); ok {
+func (x *FieldTestMessage) GetOneof_Message() *FieldTestMessage_Message {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_Oneof_Message); ok {
return x.Oneof_Message
}
return nil
}
-func (m *FieldTestMessage) GetOneofgroup() *FieldTestMessage_OneofGroup {
- if x, ok := m.GetOneofField().(*FieldTestMessage_Oneofgroup); ok {
+func (x *FieldTestMessage) GetOneofgroup() *FieldTestMessage_OneofGroup {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_Oneofgroup); ok {
return x.Oneofgroup
}
return nil
}
-func (m *FieldTestMessage) GetOneofLargestTag() int32 {
- if x, ok := m.GetOneofField().(*FieldTestMessage_OneofLargestTag); ok {
+func (x *FieldTestMessage) GetOneofLargestTag() int32 {
+ if x, ok := x.GetOneofField().(*FieldTestMessage_OneofLargestTag); ok {
return x.OneofLargestTag
}
return 0
@@ -1062,15 +1070,15 @@
return nil
}
-func (m *FieldTestMessage) GetOneofTwo_1() int32 {
- if x, ok := m.GetOneofTwo().(*FieldTestMessage_OneofTwo_1); ok {
+func (x *FieldTestMessage) GetOneofTwo_1() int32 {
+ if x, ok := x.GetOneofTwo().(*FieldTestMessage_OneofTwo_1); ok {
return x.OneofTwo_1
}
return 0
}
-func (m *FieldTestMessage) GetOneofTwo_2() int64 {
- if x, ok := m.GetOneofTwo().(*FieldTestMessage_OneofTwo_2); ok {
+func (x *FieldTestMessage) GetOneofTwo_2() int64 {
+ if x, ok := x.GetOneofTwo().(*FieldTestMessage_OneofTwo_2); ok {
return x.OneofTwo_2
}
return 0
@@ -1110,21 +1118,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage_OptionalGroup) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_fields_proto_messageTypes[1].MessageOf(m)
+func (x *FieldTestMessage_OptionalGroup) Reset() {
+ *x = FieldTestMessage_OptionalGroup{}
}
-func (m *FieldTestMessage_OptionalGroup) Reset() { *m = FieldTestMessage_OptionalGroup{} }
-func (m *FieldTestMessage_OptionalGroup) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage_OptionalGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_OptionalGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage_OptionalGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_OptionalGroup) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_fields_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage_OptionalGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_OptionalGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawDescGZIP(), []int{0, 0}
}
-func (m *FieldTestMessage_OptionalGroup) GetOptionalGroup() string {
- if m != nil && m.OptionalGroup != nil {
- return *m.OptionalGroup
+func (x *FieldTestMessage_OptionalGroup) GetOptionalGroup() string {
+ if x != nil && x.OptionalGroup != nil {
+ return *x.OptionalGroup
}
return ""
}
@@ -1136,21 +1151,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage_RequiredGroup) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_fields_proto_messageTypes[2].MessageOf(m)
+func (x *FieldTestMessage_RequiredGroup) Reset() {
+ *x = FieldTestMessage_RequiredGroup{}
}
-func (m *FieldTestMessage_RequiredGroup) Reset() { *m = FieldTestMessage_RequiredGroup{} }
-func (m *FieldTestMessage_RequiredGroup) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage_RequiredGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_RequiredGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage_RequiredGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_RequiredGroup) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_fields_proto_messageTypes[2].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage_RequiredGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_RequiredGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawDescGZIP(), []int{0, 1}
}
-func (m *FieldTestMessage_RequiredGroup) GetRequiredGroup() string {
- if m != nil && m.RequiredGroup != nil {
- return *m.RequiredGroup
+func (x *FieldTestMessage_RequiredGroup) GetRequiredGroup() string {
+ if x != nil && x.RequiredGroup != nil {
+ return *x.RequiredGroup
}
return ""
}
@@ -1162,21 +1184,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage_RepeatedGroup) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_fields_proto_messageTypes[3].MessageOf(m)
+func (x *FieldTestMessage_RepeatedGroup) Reset() {
+ *x = FieldTestMessage_RepeatedGroup{}
}
-func (m *FieldTestMessage_RepeatedGroup) Reset() { *m = FieldTestMessage_RepeatedGroup{} }
-func (m *FieldTestMessage_RepeatedGroup) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage_RepeatedGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_RepeatedGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage_RepeatedGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_RepeatedGroup) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_fields_proto_messageTypes[3].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage_RepeatedGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_RepeatedGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawDescGZIP(), []int{0, 2}
}
-func (m *FieldTestMessage_RepeatedGroup) GetRepeatedGroup() []string {
- if m != nil {
- return m.RepeatedGroup
+func (x *FieldTestMessage_RepeatedGroup) GetRepeatedGroup() []string {
+ if x != nil {
+ return x.RepeatedGroup
}
return nil
}
@@ -1188,21 +1217,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage_OneofGroup) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_fields_proto_messageTypes[7].MessageOf(m)
+func (x *FieldTestMessage_OneofGroup) Reset() {
+ *x = FieldTestMessage_OneofGroup{}
}
-func (m *FieldTestMessage_OneofGroup) Reset() { *m = FieldTestMessage_OneofGroup{} }
-func (m *FieldTestMessage_OneofGroup) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage_OneofGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_OneofGroup) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage_OneofGroup) ProtoMessage() {}
+
+func (x *FieldTestMessage_OneofGroup) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_fields_proto_messageTypes[7].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage_OneofGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_OneofGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawDescGZIP(), []int{0, 6}
}
-func (m *FieldTestMessage_OneofGroup) GetOneofGroupField() string {
- if m != nil && m.OneofGroupField != nil {
- return *m.OneofGroupField
+func (x *FieldTestMessage_OneofGroup) GetOneofGroupField() string {
+ if x != nil && x.OneofGroupField != nil {
+ return *x.OneofGroupField
}
return ""
}
@@ -1213,12 +1249,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage_Message) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_fields_proto_messageTypes[8].MessageOf(m)
+func (x *FieldTestMessage_Message) Reset() {
+ *x = FieldTestMessage_Message{}
}
-func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Message{} }
-func (m *FieldTestMessage_Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage_Message) ProtoMessage() {}
+
+func (x *FieldTestMessage_Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage_Message) ProtoMessage() {}
+
+func (x *FieldTestMessage_Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_fields_proto_messageTypes[8].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage_Message.ProtoReflect.Type instead.
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go b/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go
index 02c70b0..c9b2e46 100644
--- a/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go
@@ -20,28 +20,35 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Layer1) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_nested_messages_proto_messageTypes[0].MessageOf(m)
+func (x *Layer1) Reset() {
+ *x = Layer1{}
}
-func (m *Layer1) Reset() { *m = Layer1{} }
-func (m *Layer1) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Layer1) ProtoMessage() {}
+
+func (x *Layer1) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Layer1) ProtoMessage() {}
+
+func (x *Layer1) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_nested_messages_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Layer1.ProtoReflect.Type instead.
func (*Layer1) Descriptor() ([]byte, []int) {
return xxx_File_proto2_nested_messages_proto_rawDescGZIP(), []int{0}
}
-func (m *Layer1) GetL2() *Layer1_Layer2 {
- if m != nil {
- return m.L2
+func (x *Layer1) GetL2() *Layer1_Layer2 {
+ if x != nil {
+ return x.L2
}
return nil
}
-func (m *Layer1) GetL3() *Layer1_Layer2_Layer3 {
- if m != nil {
- return m.L3
+func (x *Layer1) GetL3() *Layer1_Layer2_Layer3 {
+ if x != nil {
+ return x.L3
}
return nil
}
@@ -53,21 +60,28 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Layer1_Layer2) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_nested_messages_proto_messageTypes[1].MessageOf(m)
+func (x *Layer1_Layer2) Reset() {
+ *x = Layer1_Layer2{}
}
-func (m *Layer1_Layer2) Reset() { *m = Layer1_Layer2{} }
-func (m *Layer1_Layer2) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Layer1_Layer2) ProtoMessage() {}
+
+func (x *Layer1_Layer2) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Layer1_Layer2) ProtoMessage() {}
+
+func (x *Layer1_Layer2) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_nested_messages_proto_messageTypes[1].MessageOf(x)
+}
// Deprecated: Use Layer1_Layer2.ProtoReflect.Type instead.
func (*Layer1_Layer2) Descriptor() ([]byte, []int) {
return xxx_File_proto2_nested_messages_proto_rawDescGZIP(), []int{0, 0}
}
-func (m *Layer1_Layer2) GetL3() *Layer1_Layer2_Layer3 {
- if m != nil {
- return m.L3
+func (x *Layer1_Layer2) GetL3() *Layer1_Layer2_Layer3 {
+ if x != nil {
+ return x.L3
}
return nil
}
@@ -78,12 +92,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Layer1_Layer2_Layer3) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_nested_messages_proto_messageTypes[2].MessageOf(m)
+func (x *Layer1_Layer2_Layer3) Reset() {
+ *x = Layer1_Layer2_Layer3{}
}
-func (m *Layer1_Layer2_Layer3) Reset() { *m = Layer1_Layer2_Layer3{} }
-func (m *Layer1_Layer2_Layer3) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Layer1_Layer2_Layer3) ProtoMessage() {}
+
+func (x *Layer1_Layer2_Layer3) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Layer1_Layer2_Layer3) ProtoMessage() {}
+
+func (x *Layer1_Layer2_Layer3) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_nested_messages_proto_messageTypes[2].MessageOf(x)
+}
// Deprecated: Use Layer1_Layer2_Layer3.ProtoReflect.Type instead.
func (*Layer1_Layer2_Layer3) Descriptor() ([]byte, []int) {
diff --git a/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go b/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
index 3c5eb9a..2ac0ff1 100644
--- a/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
@@ -20,28 +20,35 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *Message) ProtoReflect() protoreflect.Message {
- return xxx_File_proto2_proto2_proto_messageTypes[0].MessageOf(m)
+func (x *Message) Reset() {
+ *x = Message{}
}
-func (m *Message) Reset() { *m = Message{} }
-func (m *Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*Message) ProtoMessage() {}
+
+func (x *Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Message) ProtoMessage() {}
+
+func (x *Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto2_proto2_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_proto2_proto2_proto_rawDescGZIP(), []int{0}
}
-func (m *Message) GetI32() int32 {
- if m != nil && m.I32 != nil {
- return *m.I32
+func (x *Message) GetI32() int32 {
+ if x != nil && x.I32 != nil {
+ return *x.I32
}
return 0
}
-func (m *Message) GetM() *Message {
- if m != nil {
- return m.M
+func (x *Message) GetM() *Message {
+ if x != nil {
+ return x.M
}
return nil
}
diff --git a/cmd/protoc-gen-go/testdata/proto3/enum.pb.go b/cmd/protoc-gen-go/testdata/proto3/enum.pb.go
index 6b466e8..2cfa3a7 100644
--- a/cmd/protoc-gen-go/testdata/proto3/enum.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto3/enum.pb.go
@@ -20,13 +20,6 @@
Enum_TWO Enum = 2
)
-func (e Enum) Type() protoreflect.EnumType {
- return xxx_File_proto3_enum_proto_enumTypes[0]
-}
-func (e Enum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
@@ -45,6 +38,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (Enum) Type() protoreflect.EnumType {
+ return xxx_File_proto3_enum_proto_enumTypes[0]
+}
+
+func (x Enum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Use Enum.Type instead.
func (Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto3_enum_proto_rawDescGZIP(), []int{0}
diff --git a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
index 8a10f2e..8cb68f6 100644
--- a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
@@ -18,13 +18,6 @@
FieldTestMessage_ZERO FieldTestMessage_Enum = 0
)
-func (e FieldTestMessage_Enum) Type() protoreflect.EnumType {
- return xxx_File_proto3_fields_proto_enumTypes[0]
-}
-func (e FieldTestMessage_Enum) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(e)
-}
-
// Deprecated: Use FieldTestMessage_Enum.Type.Values instead.
var FieldTestMessage_Enum_name = map[int32]string{
0: "ZERO",
@@ -39,6 +32,14 @@
return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+func (FieldTestMessage_Enum) Type() protoreflect.EnumType {
+ return xxx_File_proto3_fields_proto_enumTypes[0]
+}
+
+func (x FieldTestMessage_Enum) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
// Deprecated: Use FieldTestMessage_Enum.Type instead.
func (FieldTestMessage_Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto3_fields_proto_rawDescGZIP(), []int{0, 0}
@@ -87,273 +88,280 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage) ProtoReflect() protoreflect.Message {
- return xxx_File_proto3_fields_proto_messageTypes[0].MessageOf(m)
+func (x *FieldTestMessage) Reset() {
+ *x = FieldTestMessage{}
}
-func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
-func (m *FieldTestMessage) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage) ProtoMessage() {}
+
+func (x *FieldTestMessage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage) ProtoMessage() {}
+
+func (x *FieldTestMessage) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto3_fields_proto_messageTypes[0].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage.ProtoReflect.Type instead.
func (*FieldTestMessage) Descriptor() ([]byte, []int) {
return xxx_File_proto3_fields_proto_rawDescGZIP(), []int{0}
}
-func (m *FieldTestMessage) GetOptionalBool() string {
- if m != nil {
- return m.OptionalBool
+func (x *FieldTestMessage) GetOptionalBool() string {
+ if x != nil {
+ return x.OptionalBool
}
return ""
}
-func (m *FieldTestMessage) GetOptionalEnum() FieldTestMessage_Enum {
- if m != nil {
- return m.OptionalEnum
+func (x *FieldTestMessage) GetOptionalEnum() FieldTestMessage_Enum {
+ if x != nil {
+ return x.OptionalEnum
}
return FieldTestMessage_ZERO
}
-func (m *FieldTestMessage) GetOptionalInt32() int32 {
- if m != nil {
- return m.OptionalInt32
+func (x *FieldTestMessage) GetOptionalInt32() int32 {
+ if x != nil {
+ return x.OptionalInt32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSint32() int32 {
- if m != nil {
- return m.OptionalSint32
+func (x *FieldTestMessage) GetOptionalSint32() int32 {
+ if x != nil {
+ return x.OptionalSint32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalUint32() uint32 {
- if m != nil {
- return m.OptionalUint32
+func (x *FieldTestMessage) GetOptionalUint32() uint32 {
+ if x != nil {
+ return x.OptionalUint32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalInt64() int64 {
- if m != nil {
- return m.OptionalInt64
+func (x *FieldTestMessage) GetOptionalInt64() int64 {
+ if x != nil {
+ return x.OptionalInt64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSint64() int64 {
- if m != nil {
- return m.OptionalSint64
+func (x *FieldTestMessage) GetOptionalSint64() int64 {
+ if x != nil {
+ return x.OptionalSint64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalUint64() uint64 {
- if m != nil {
- return m.OptionalUint64
+func (x *FieldTestMessage) GetOptionalUint64() uint64 {
+ if x != nil {
+ return x.OptionalUint64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSfixed32() int32 {
- if m != nil {
- return m.OptionalSfixed32
+func (x *FieldTestMessage) GetOptionalSfixed32() int32 {
+ if x != nil {
+ return x.OptionalSfixed32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalFixed32() uint32 {
- if m != nil {
- return m.OptionalFixed32
+func (x *FieldTestMessage) GetOptionalFixed32() uint32 {
+ if x != nil {
+ return x.OptionalFixed32
}
return 0
}
-func (m *FieldTestMessage) GetOptionalFloat() float32 {
- if m != nil {
- return m.OptionalFloat
+func (x *FieldTestMessage) GetOptionalFloat() float32 {
+ if x != nil {
+ return x.OptionalFloat
}
return 0
}
-func (m *FieldTestMessage) GetOptionalSfixed64() int64 {
- if m != nil {
- return m.OptionalSfixed64
+func (x *FieldTestMessage) GetOptionalSfixed64() int64 {
+ if x != nil {
+ return x.OptionalSfixed64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalFixed64() uint64 {
- if m != nil {
- return m.OptionalFixed64
+func (x *FieldTestMessage) GetOptionalFixed64() uint64 {
+ if x != nil {
+ return x.OptionalFixed64
}
return 0
}
-func (m *FieldTestMessage) GetOptionalDouble() float64 {
- if m != nil {
- return m.OptionalDouble
+func (x *FieldTestMessage) GetOptionalDouble() float64 {
+ if x != nil {
+ return x.OptionalDouble
}
return 0
}
-func (m *FieldTestMessage) GetOptionalString() string {
- if m != nil {
- return m.OptionalString
+func (x *FieldTestMessage) GetOptionalString() string {
+ if x != nil {
+ return x.OptionalString
}
return ""
}
-func (m *FieldTestMessage) GetOptionalBytes() []byte {
- if m != nil {
- return m.OptionalBytes
+func (x *FieldTestMessage) GetOptionalBytes() []byte {
+ if x != nil {
+ return x.OptionalBytes
}
return nil
}
-func (m *FieldTestMessage) GetOptional_Message() *FieldTestMessage_Message {
- if m != nil {
- return m.Optional_Message
+func (x *FieldTestMessage) GetOptional_Message() *FieldTestMessage_Message {
+ if x != nil {
+ return x.Optional_Message
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedBool() []bool {
- if m != nil {
- return m.RepeatedBool
+func (x *FieldTestMessage) GetRepeatedBool() []bool {
+ if x != nil {
+ return x.RepeatedBool
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedEnum() []FieldTestMessage_Enum {
- if m != nil {
- return m.RepeatedEnum
+func (x *FieldTestMessage) GetRepeatedEnum() []FieldTestMessage_Enum {
+ if x != nil {
+ return x.RepeatedEnum
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedInt32() []int32 {
- if m != nil {
- return m.RepeatedInt32
+func (x *FieldTestMessage) GetRepeatedInt32() []int32 {
+ if x != nil {
+ return x.RepeatedInt32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSint32() []int32 {
- if m != nil {
- return m.RepeatedSint32
+func (x *FieldTestMessage) GetRepeatedSint32() []int32 {
+ if x != nil {
+ return x.RepeatedSint32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedUint32() []uint32 {
- if m != nil {
- return m.RepeatedUint32
+func (x *FieldTestMessage) GetRepeatedUint32() []uint32 {
+ if x != nil {
+ return x.RepeatedUint32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedInt64() []int64 {
- if m != nil {
- return m.RepeatedInt64
+func (x *FieldTestMessage) GetRepeatedInt64() []int64 {
+ if x != nil {
+ return x.RepeatedInt64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSint64() []int64 {
- if m != nil {
- return m.RepeatedSint64
+func (x *FieldTestMessage) GetRepeatedSint64() []int64 {
+ if x != nil {
+ return x.RepeatedSint64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedUint64() []uint64 {
- if m != nil {
- return m.RepeatedUint64
+func (x *FieldTestMessage) GetRepeatedUint64() []uint64 {
+ if x != nil {
+ return x.RepeatedUint64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSfixed32() []int32 {
- if m != nil {
- return m.RepeatedSfixed32
+func (x *FieldTestMessage) GetRepeatedSfixed32() []int32 {
+ if x != nil {
+ return x.RepeatedSfixed32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedFixed32() []uint32 {
- if m != nil {
- return m.RepeatedFixed32
+func (x *FieldTestMessage) GetRepeatedFixed32() []uint32 {
+ if x != nil {
+ return x.RepeatedFixed32
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedFloat() []float32 {
- if m != nil {
- return m.RepeatedFloat
+func (x *FieldTestMessage) GetRepeatedFloat() []float32 {
+ if x != nil {
+ return x.RepeatedFloat
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedSfixed64() []int64 {
- if m != nil {
- return m.RepeatedSfixed64
+func (x *FieldTestMessage) GetRepeatedSfixed64() []int64 {
+ if x != nil {
+ return x.RepeatedSfixed64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedFixed64() []uint64 {
- if m != nil {
- return m.RepeatedFixed64
+func (x *FieldTestMessage) GetRepeatedFixed64() []uint64 {
+ if x != nil {
+ return x.RepeatedFixed64
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedDouble() []float64 {
- if m != nil {
- return m.RepeatedDouble
+func (x *FieldTestMessage) GetRepeatedDouble() []float64 {
+ if x != nil {
+ return x.RepeatedDouble
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedString() []string {
- if m != nil {
- return m.RepeatedString
+func (x *FieldTestMessage) GetRepeatedString() []string {
+ if x != nil {
+ return x.RepeatedString
}
return nil
}
-func (m *FieldTestMessage) GetRepeatedBytes() [][]byte {
- if m != nil {
- return m.RepeatedBytes
+func (x *FieldTestMessage) GetRepeatedBytes() [][]byte {
+ if x != nil {
+ return x.RepeatedBytes
}
return nil
}
-func (m *FieldTestMessage) GetRepeated_Message() []*FieldTestMessage_Message {
- if m != nil {
- return m.Repeated_Message
+func (x *FieldTestMessage) GetRepeated_Message() []*FieldTestMessage_Message {
+ if x != nil {
+ return x.Repeated_Message
}
return nil
}
-func (m *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
- if m != nil {
- return m.MapInt32Int64
+func (x *FieldTestMessage) GetMapInt32Int64() map[int32]int64 {
+ if x != nil {
+ return x.MapInt32Int64
}
return nil
}
-func (m *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
- if m != nil {
- return m.MapStringMessage
+func (x *FieldTestMessage) GetMapStringMessage() map[string]*FieldTestMessage_Message {
+ if x != nil {
+ return x.MapStringMessage
}
return nil
}
-func (m *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
- if m != nil {
- return m.MapFixed64Enum
+func (x *FieldTestMessage) GetMapFixed64Enum() map[uint64]FieldTestMessage_Enum {
+ if x != nil {
+ return x.MapFixed64Enum
}
return nil
}
@@ -364,12 +372,19 @@
XXX_sizecache int32 `json:"-"`
}
-func (m *FieldTestMessage_Message) ProtoReflect() protoreflect.Message {
- return xxx_File_proto3_fields_proto_messageTypes[4].MessageOf(m)
+func (x *FieldTestMessage_Message) Reset() {
+ *x = FieldTestMessage_Message{}
}
-func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Message{} }
-func (m *FieldTestMessage_Message) String() string { return protoimpl.X.MessageStringOf(m) }
-func (*FieldTestMessage_Message) ProtoMessage() {}
+
+func (x *FieldTestMessage_Message) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FieldTestMessage_Message) ProtoMessage() {}
+
+func (x *FieldTestMessage_Message) ProtoReflect() protoreflect.Message {
+ return xxx_File_proto3_fields_proto_messageTypes[4].MessageOf(x)
+}
// Deprecated: Use FieldTestMessage_Message.ProtoReflect.Type instead.
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {