cmd/protoc-gen-go: rely on protoimpl for basic helpers
The EnumName, UnmarshalJSONEnum, and CompressGZIP helpers currently live
in v1 protoapi, which would cause all generated messages to depend on v1.
In an effort to break the dependency of v2 on v1, we move these helper
functions to v2 (and re-written to take advantage of protobuf reflection).
These helpers are unfortunate, but we cannot eliminate the functionality
that they implement since they are exposed in the publicly generated API.
Since EnumName does not rely on the enum maps, it removes another dependency
on those variables. Eventually, we can get to the point where these variables
(though declared) are not linked into the binary if the user does not use them.
Also, we rely on the v1 proto package for registration instead of v1 protoapi.
This may re-introduce a cyclic dependency on descriptor proto again in the
future, but the better approach is to just start registering with v2.
Change-Id: Id755585a7a1df14e4a6a2dfa650df221a3c153fb
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/167921
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
index cbf24fe..139bdaa 100644
--- a/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
+++ b/cmd/protoc-gen-go/testdata/annotations/annotations.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type AnnotationsTestEnum int32
const (
@@ -30,33 +23,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use AnnotationsTestEnum.Type.Values instead.
var AnnotationsTestEnum_name = map[int32]string{
0: "ANNOTATIONS_TEST_ENUM_VALUE",
}
+// Deprecated: Use AnnotationsTestEnum.Type.Values instead.
var AnnotationsTestEnum_value = map[string]int32{
"ANNOTATIONS_TEST_ENUM_VALUE": 0,
}
func (x AnnotationsTestEnum) Enum() *AnnotationsTestEnum {
- p := new(AnnotationsTestEnum)
- *p = x
- return p
+ return &x
}
func (x AnnotationsTestEnum) String() string {
- return proto.EnumName(AnnotationsTestEnum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *AnnotationsTestEnum) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(AnnotationsTestEnum_value, data, "AnnotationsTestEnum")
+// Deprecated: Do not use.
+func (x *AnnotationsTestEnum) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = AnnotationsTestEnum(value)
+ *x = AnnotationsTestEnum(num)
return nil
}
+// Deprecated: Use AnnotationsTestEnum.Type instead.
func (AnnotationsTestEnum) EnumDescriptor() ([]byte, []int) {
return xxx_File_annotations_annotations_proto_rawdesc_gzipped, []int{0}
}
@@ -74,6 +69,8 @@
func (m *AnnotationsTestMessage) Reset() { *m = AnnotationsTestMessage{} }
func (m *AnnotationsTestMessage) String() string { return proto.CompactTextString(m) }
func (*AnnotationsTestMessage) ProtoMessage() {}
+
+// Deprecated: Use AnnotationsTestMessage.ProtoReflect.Type instead.
func (*AnnotationsTestMessage) Descriptor() ([]byte, []int) {
return xxx_File_annotations_annotations_proto_rawdesc_gzipped, []int{0}
}
@@ -130,7 +127,7 @@
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
}
-var xxx_File_annotations_annotations_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_annotations_annotations_proto_rawdesc)
+var xxx_File_annotations_annotations_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_annotations_annotations_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 503b614..c966993 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:687 end:706 > annotation:<path:5 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:723 end:770 > annotation:<path:4 path:0 source_file:"annotations/annotations.proto" begin:1801 end:1823 > annotation:<path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:1834 end:1854 > annotation:<path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:3339 end:3362 >
\ No newline at end of file
+annotation:<path:5 path:0 source_file:"annotations/annotations.proto" begin:318 end:337 > annotation:<path:5 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:354 end:401 > annotation:<path:4 path:0 source_file:"annotations/annotations.proto" begin:1562 end:1584 > annotation:<path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:1595 end:1615 > annotation:<path:4 path:0 path:2 path:0 source_file:"annotations/annotations.proto" begin:3170 end:3193 >
\ 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 9b050e5..6f1d23e 100644
--- a/cmd/protoc-gen-go/testdata/comments/comments.pb.go
+++ b/cmd/protoc-gen-go/testdata/comments/comments.pb.go
@@ -7,18 +7,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
// COMMENT: Message1
type Message1 struct {
// COMMENT: Field1A
@@ -40,6 +33,8 @@
func (m *Message1) Reset() { *m = Message1{} }
func (m *Message1) String() string { return proto.CompactTextString(m) }
func (*Message1) ProtoMessage() {}
+
+// Deprecated: Use Message1.ProtoReflect.Type instead.
func (*Message1) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawdesc_gzipped, []int{0}
}
@@ -113,6 +108,8 @@
func (m *Message2) Reset() { *m = Message2{} }
func (m *Message2) String() string { return proto.CompactTextString(m) }
func (*Message2) ProtoMessage() {}
+
+// Deprecated: Use Message2.ProtoReflect.Type instead.
func (*Message2) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawdesc_gzipped, []int{1}
}
@@ -148,6 +145,8 @@
func (m *Message1_Message1A) Reset() { *m = Message1_Message1A{} }
func (m *Message1_Message1A) String() string { return proto.CompactTextString(m) }
func (*Message1_Message1A) ProtoMessage() {}
+
+// Deprecated: Use Message1_Message1A.ProtoReflect.Type instead.
func (*Message1_Message1A) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -183,6 +182,8 @@
func (m *Message1_Message1B) Reset() { *m = Message1_Message1B{} }
func (m *Message1_Message1B) String() string { return proto.CompactTextString(m) }
func (*Message1_Message1B) ProtoMessage() {}
+
+// Deprecated: Use Message1_Message1B.ProtoReflect.Type instead.
func (*Message1_Message1B) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawdesc_gzipped, []int{0, 1}
}
@@ -218,6 +219,8 @@
func (m *Message2_Message2A) Reset() { *m = Message2_Message2A{} }
func (m *Message2_Message2A) String() string { return proto.CompactTextString(m) }
func (*Message2_Message2A) ProtoMessage() {}
+
+// Deprecated: Use Message2_Message2A.ProtoReflect.Type instead.
func (*Message2_Message2A) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawdesc_gzipped, []int{1, 0}
}
@@ -253,6 +256,8 @@
func (m *Message2_Message2B) Reset() { *m = Message2_Message2B{} }
func (m *Message2_Message2B) String() string { return proto.CompactTextString(m) }
func (*Message2_Message2B) ProtoMessage() {}
+
+// Deprecated: Use Message2_Message2B.ProtoReflect.Type instead.
func (*Message2_Message2B) Descriptor() ([]byte, []int) {
return xxx_File_comments_comments_proto_rawdesc_gzipped, []int{1, 1}
}
@@ -306,7 +311,7 @@
0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73,
}
-var xxx_File_comments_comments_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_comments_comments_proto_rawdesc)
+var xxx_File_comments_comments_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_comments_comments_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go b/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
index adb5c82..442e208 100644
--- a/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
+++ b/cmd/protoc-gen-go/testdata/comments/deprecated.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type DeprecatedEnum int32 // Deprecated: Do not use.
const (
DeprecatedEnum_DEPRECATED DeprecatedEnum = 0 // Deprecated: Do not use.
@@ -29,18 +22,21 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use DeprecatedEnum.Type.Values instead.
var DeprecatedEnum_name = map[int32]string{
0: "DEPRECATED",
}
+// Deprecated: Use DeprecatedEnum.Type.Values instead.
var DeprecatedEnum_value = map[string]int32{
"DEPRECATED": 0,
}
func (x DeprecatedEnum) String() string {
- return proto.EnumName(DeprecatedEnum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+// Deprecated: Use DeprecatedEnum.Type instead.
func (DeprecatedEnum) EnumDescriptor() ([]byte, []int) {
return xxx_File_comments_deprecated_proto_rawdesc_gzipped, []int{0}
}
@@ -59,6 +55,8 @@
func (m *DeprecatedMessage) Reset() { *m = DeprecatedMessage{} }
func (m *DeprecatedMessage) String() string { return proto.CompactTextString(m) }
func (*DeprecatedMessage) ProtoMessage() {}
+
+// Deprecated: Use DeprecatedMessage.ProtoReflect.Type instead.
func (*DeprecatedMessage) Descriptor() ([]byte, []int) {
return xxx_File_comments_deprecated_proto_rawdesc_gzipped, []int{0}
}
@@ -115,7 +113,7 @@
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_comments_deprecated_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_comments_deprecated_proto_rawdesc)
+var xxx_File_comments_deprecated_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_comments_deprecated_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 6c78a69..b18d32d 100644
--- a/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/base/base.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type BaseMessage struct {
Field *string `protobuf:"bytes,1,opt,name=field" json:"field,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -31,6 +24,8 @@
func (m *BaseMessage) Reset() { *m = BaseMessage{} }
func (m *BaseMessage) String() string { return proto.CompactTextString(m) }
func (*BaseMessage) ProtoMessage() {}
+
+// Deprecated: Use BaseMessage.ProtoReflect.Type instead.
func (*BaseMessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_base_base_proto_rawdesc_gzipped, []int{0}
}
@@ -40,6 +35,7 @@
{Start: 16, End: 536870911},
}
+// Deprecated: Use BaseMessage.ProtoReflect.Type.ExtensionRanges instead.
func (*BaseMessage) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_BaseMessage
}
@@ -82,6 +78,8 @@
func (m *MessageSetWireFormatMessage) Reset() { *m = MessageSetWireFormatMessage{} }
func (m *MessageSetWireFormatMessage) String() string { return proto.CompactTextString(m) }
func (*MessageSetWireFormatMessage) ProtoMessage() {}
+
+// Deprecated: Use MessageSetWireFormatMessage.ProtoReflect.Type instead.
func (*MessageSetWireFormatMessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_base_base_proto_rawdesc_gzipped, []int{1}
}
@@ -90,6 +88,7 @@
{Start: 100, End: 2147483646},
}
+// Deprecated: Use MessageSetWireFormatMessage.ProtoReflect.Type.ExtensionRanges instead.
func (*MessageSetWireFormatMessage) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_MessageSetWireFormatMessage
}
@@ -137,7 +136,7 @@
0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65,
}
-var xxx_File_extensions_base_base_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extensions_base_base_proto_rawdesc)
+var xxx_File_extensions_base_base_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_extensions_base_base_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 6800c2e..2d08e1c 100644
--- a/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/ext/ext.pb.go
@@ -5,7 +5,6 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
base "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/base"
extra "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/extra"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
@@ -13,12 +12,6 @@
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Enum int32
const (
@@ -32,33 +25,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_value = map[string]int32{
"ZERO": 0,
}
func (x Enum) Enum() *Enum {
- p := new(Enum)
- *p = x
- return p
+ return &x
}
func (x Enum) String() string {
- return proto.EnumName(Enum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *Enum) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(Enum_value, data, "Enum")
+// Deprecated: Do not use.
+func (x *Enum) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = Enum(value)
+ *x = Enum(num)
return nil
}
+// Deprecated: Use Enum.Type instead.
func (Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{0}
}
@@ -76,6 +71,8 @@
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
+
+// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{0}
}
@@ -118,6 +115,8 @@
func (m *ExtensionGroup) Reset() { *m = ExtensionGroup{} }
func (m *ExtensionGroup) String() string { return proto.CompactTextString(m) }
func (*ExtensionGroup) ProtoMessage() {}
+
+// Deprecated: Use ExtensionGroup.ProtoReflect.Type instead.
func (*ExtensionGroup) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{1}
}
@@ -160,6 +159,8 @@
func (m *ExtendingMessage) Reset() { *m = ExtendingMessage{} }
func (m *ExtendingMessage) String() string { return proto.CompactTextString(m) }
func (*ExtendingMessage) ProtoMessage() {}
+
+// Deprecated: Use ExtendingMessage.ProtoReflect.Type instead.
func (*ExtendingMessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{2}
}
@@ -195,6 +196,8 @@
func (m *RepeatedGroup) Reset() { *m = RepeatedGroup{} }
func (m *RepeatedGroup) String() string { return proto.CompactTextString(m) }
func (*RepeatedGroup) ProtoMessage() {}
+
+// Deprecated: Use RepeatedGroup.ProtoReflect.Type instead.
func (*RepeatedGroup) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{3}
}
@@ -238,6 +241,8 @@
func (m *Extendable) Reset() { *m = Extendable{} }
func (m *Extendable) String() string { return proto.CompactTextString(m) }
func (*Extendable) ProtoMessage() {}
+
+// Deprecated: Use Extendable.ProtoReflect.Type instead.
func (*Extendable) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{4}
}
@@ -246,6 +251,7 @@
{Start: 1, End: 536870911},
}
+// Deprecated: Use Extendable.ProtoReflect.Type.ExtensionRanges instead.
func (*Extendable) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_Extendable
}
@@ -281,6 +287,8 @@
func (m *MessageSetWireFormatExtension) Reset() { *m = MessageSetWireFormatExtension{} }
func (m *MessageSetWireFormatExtension) String() string { return proto.CompactTextString(m) }
func (*MessageSetWireFormatExtension) ProtoMessage() {}
+
+// Deprecated: Use MessageSetWireFormatExtension.ProtoReflect.Type instead.
func (*MessageSetWireFormatExtension) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{5}
}
@@ -315,6 +323,8 @@
func (m *Message_M) Reset() { *m = Message_M{} }
func (m *Message_M) String() string { return proto.CompactTextString(m) }
func (*Message_M) ProtoMessage() {}
+
+// Deprecated: Use Message_M.ProtoReflect.Type instead.
func (*Message_M) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -353,6 +363,8 @@
return proto.CompactTextString(m)
}
func (*ExtendingMessage_ExtendingMessageSubmessage) ProtoMessage() {}
+
+// Deprecated: Use ExtendingMessage_ExtendingMessageSubmessage.ProtoReflect.Type instead.
func (*ExtendingMessage_ExtendingMessageSubmessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{2, 0}
}
@@ -1237,7 +1249,7 @@
0x2f, 0x65, 0x78, 0x74,
}
-var xxx_File_extensions_ext_ext_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extensions_ext_ext_proto_rawdesc)
+var xxx_File_extensions_ext_ext_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_extensions_ext_ext_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 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 def11a0..9019b87 100644
--- a/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/extra/extra.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type ExtraMessage struct {
Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -30,6 +23,8 @@
func (m *ExtraMessage) Reset() { *m = ExtraMessage{} }
func (m *ExtraMessage) String() string { return proto.CompactTextString(m) }
func (*ExtraMessage) ProtoMessage() {}
+
+// Deprecated: Use ExtraMessage.ProtoReflect.Type instead.
func (*ExtraMessage) Descriptor() ([]byte, []int) {
return xxx_File_extensions_extra_extra_proto_rawdesc_gzipped, []int{0}
}
@@ -79,7 +74,7 @@
0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74, 0x72, 0x61,
}
-var xxx_File_extensions_extra_extra_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extensions_extra_extra_proto_rawdesc)
+var xxx_File_extensions_extra_extra_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_extensions_extra_extra_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 89b2700..bc1aac9 100644
--- a/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
+++ b/cmd/protoc-gen-go/testdata/extensions/proto3/ext3.pb.go
@@ -5,19 +5,12 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
descriptor "github.com/golang/protobuf/v2/types/descriptor"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Enum int32
const (
@@ -31,18 +24,21 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_value = map[string]int32{
"ZERO": 0,
}
func (x Enum) String() string {
- return proto.EnumName(Enum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+// Deprecated: Use Enum.Type instead.
func (Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_extensions_proto3_ext3_proto_rawdesc_gzipped, []int{0}
}
@@ -59,6 +55,8 @@
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
+
+// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_extensions_proto3_ext3_proto_rawdesc_gzipped, []int{0}
}
@@ -708,7 +706,7 @@
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_extensions_proto3_ext3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_extensions_proto3_ext3_proto_rawdesc)
+var xxx_File_extensions_proto3_ext3_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_extensions_proto3_ext3_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go b/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
index d7d429a..d42049a 100644
--- a/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
+++ b/cmd/protoc-gen-go/testdata/fieldnames/fieldnames.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
// Assorted edge cases in field name conflict resolution.
//
// Not all (or possibly any) of these behave in an easily-understood fashion.
@@ -68,6 +61,8 @@
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
+
+// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_fieldnames_fieldnames_proto_rawdesc_gzipped, []int{0}
}
@@ -295,6 +290,8 @@
func (m *Message_OneofMessageConflict) Reset() { *m = Message_OneofMessageConflict{} }
func (m *Message_OneofMessageConflict) String() string { return proto.CompactTextString(m) }
func (*Message_OneofMessageConflict) ProtoMessage() {}
+
+// Deprecated: Use Message_OneofMessageConflict.ProtoReflect.Type instead.
func (*Message_OneofMessageConflict) Descriptor() ([]byte, []int) {
return xxx_File_fieldnames_fieldnames_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -379,7 +376,7 @@
0x66, 0x69, 0x65, 0x6c, 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x73,
}
-var xxx_File_fieldnames_fieldnames_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_fieldnames_fieldnames_proto_rawdesc)
+var xxx_File_fieldnames_fieldnames_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_fieldnames_fieldnames_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 6c5418e..402131b 100644
--- a/cmd/protoc-gen-go/testdata/import_public/a.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/a.pb.go
@@ -5,7 +5,6 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
sub "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub"
sub2 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub2"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
@@ -13,12 +12,6 @@
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
// Symbols defined in public import of import_public/sub/a.proto
type E = sub.E
@@ -76,6 +69,8 @@
func (m *Public) Reset() { *m = Public{} }
func (m *Public) String() string { return proto.CompactTextString(m) }
func (*Public) ProtoMessage() {}
+
+// Deprecated: Use Public.ProtoReflect.Type instead.
func (*Public) Descriptor() ([]byte, []int) {
return xxx_File_import_public_a_proto_rawdesc_gzipped, []int{0}
}
@@ -152,7 +147,7 @@
0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x00, 0x50, 0x01, 0x50, 0x02,
}
-var xxx_File_import_public_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_a_proto_rawdesc)
+var xxx_File_import_public_a_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_import_public_a_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 19e44f3..3cd1d46 100644
--- a/cmd/protoc-gen-go/testdata/import_public/b.pb.go
+++ b/cmd/protoc-gen-go/testdata/import_public/b.pb.go
@@ -5,19 +5,12 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
sub "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Local struct {
M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"`
E *sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.protoc.import_public.sub.E" json:"e,omitempty"`
@@ -32,6 +25,8 @@
func (m *Local) Reset() { *m = Local{} }
func (m *Local) String() string { return proto.CompactTextString(m) }
func (*Local) ProtoMessage() {}
+
+// Deprecated: Use Local.ProtoReflect.Type instead.
func (*Local) Descriptor() ([]byte, []int) {
return xxx_File_import_public_b_proto_rawdesc_gzipped, []int{0}
}
@@ -94,7 +89,7 @@
0x72, 0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
}
-var xxx_File_import_public_b_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_b_proto_rawdesc)
+var xxx_File_import_public_b_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_import_public_b_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 b486899..0397983 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
@@ -5,7 +5,6 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
sub2 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub2"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
@@ -13,12 +12,6 @@
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
// Symbols defined in public import of import_public/sub2/a.proto
type Sub2Message = sub2.Sub2Message
@@ -36,33 +29,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use E.Type.Values instead.
var E_name = map[int32]string{
0: "ZERO",
}
+// Deprecated: Use E.Type.Values instead.
var E_value = map[string]int32{
"ZERO": 0,
}
func (x E) Enum() *E {
- p := new(E)
- *p = x
- return p
+ return &x
}
func (x E) String() string {
- return proto.EnumName(E_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *E) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(E_value, data, "E")
+// Deprecated: Do not use.
+func (x *E) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = E(value)
+ *x = E(num)
return nil
}
+// Deprecated: Use E.Type instead.
func (E) EnumDescriptor() ([]byte, []int) {
return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0}
}
@@ -80,33 +75,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use M_Subenum.Type.Values instead.
var M_Subenum_name = map[int32]string{
0: "M_ZERO",
}
+// Deprecated: Use M_Subenum.Type.Values instead.
var M_Subenum_value = map[string]int32{
"M_ZERO": 0,
}
func (x M_Subenum) Enum() *M_Subenum {
- p := new(M_Subenum)
- *p = x
- return p
+ return &x
}
func (x M_Subenum) String() string {
- return proto.EnumName(M_Subenum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *M_Subenum) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(M_Subenum_value, data, "M_Subenum")
+// Deprecated: Do not use.
+func (x *M_Subenum) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = M_Subenum(value)
+ *x = M_Subenum(num)
return nil
}
+// Deprecated: Use M_Subenum.Type instead.
func (M_Subenum) EnumDescriptor() ([]byte, []int) {
return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -124,33 +121,35 @@
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",
}
+// Deprecated: Use M_Submessage_Submessage_Subenum.Type.Values instead.
var M_Submessage_Submessage_Subenum_value = map[string]int32{
"M_SUBMESSAGE_ZERO": 0,
}
func (x M_Submessage_Submessage_Subenum) Enum() *M_Submessage_Submessage_Subenum {
- p := new(M_Submessage_Submessage_Subenum)
- *p = x
- return p
+ return &x
}
func (x M_Submessage_Submessage_Subenum) String() string {
- return proto.EnumName(M_Submessage_Submessage_Subenum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *M_Submessage_Submessage_Subenum) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(M_Submessage_Submessage_Subenum_value, data, "M_Submessage_Submessage_Subenum")
+// Deprecated: Do not use.
+func (x *M_Submessage_Submessage_Subenum) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = M_Submessage_Submessage_Subenum(value)
+ *x = M_Submessage_Submessage_Subenum(num)
return nil
}
+// Deprecated: Use M_Submessage_Submessage_Subenum.Type instead.
func (M_Submessage_Submessage_Subenum) EnumDescriptor() ([]byte, []int) {
return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0, 0}
}
@@ -177,6 +176,8 @@
func (m *M) Reset() { *m = M{} }
func (m *M) String() string { return proto.CompactTextString(m) }
func (*M) ProtoMessage() {}
+
+// Deprecated: Use M.ProtoReflect.Type instead.
func (*M) Descriptor() ([]byte, []int) {
return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0}
}
@@ -185,6 +186,7 @@
{Start: 100, End: 536870911},
}
+// Deprecated: Use M.ProtoReflect.Type.ExtensionRanges instead.
func (*M) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_M
}
@@ -301,6 +303,8 @@
func (m *M_Submessage) Reset() { *m = M_Submessage{} }
func (m *M_Submessage) String() string { return proto.CompactTextString(m) }
func (*M_Submessage) ProtoMessage() {}
+
+// Deprecated: Use M_Submessage.ProtoReflect.Type instead.
func (*M_Submessage) Descriptor() ([]byte, []int) {
return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -443,7 +447,7 @@
0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x50, 0x01,
}
-var xxx_File_import_public_sub_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub_a_proto_rawdesc)
+var xxx_File_import_public_sub_a_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_import_public_sub_a_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 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 b45dd3b..81c15f1 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M2 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M2) Reset() { *m = M2{} }
func (m *M2) String() string { return proto.CompactTextString(m) }
func (*M2) ProtoMessage() {}
+
+// Deprecated: Use M2.ProtoReflect.Type instead.
func (*M2) Descriptor() ([]byte, []int) {
return xxx_File_import_public_sub_b_proto_rawdesc_gzipped, []int{0}
}
@@ -70,7 +65,7 @@
0x62,
}
-var xxx_File_import_public_sub_b_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub_b_proto_rawdesc)
+var xxx_File_import_public_sub_b_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_import_public_sub_b_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 add3a91..daf8aea 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Sub2Message struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *Sub2Message) Reset() { *m = Sub2Message{} }
func (m *Sub2Message) String() string { return proto.CompactTextString(m) }
func (*Sub2Message) ProtoMessage() {}
+
+// Deprecated: Use Sub2Message.ProtoReflect.Type instead.
func (*Sub2Message) Descriptor() ([]byte, []int) {
return xxx_File_import_public_sub2_a_proto_rawdesc_gzipped, []int{0}
}
@@ -70,7 +65,7 @@
0x74, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x73, 0x75, 0x62, 0x32,
}
-var xxx_File_import_public_sub2_a_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_import_public_sub2_a_proto_rawdesc)
+var xxx_File_import_public_sub2_a_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_import_public_sub2_a_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 f52f772..28834f7 100644
--- a/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go
+++ b/cmd/protoc-gen-go/testdata/imports/fmt/m.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M) Reset() { *m = M{} }
func (m *M) String() string { return proto.CompactTextString(m) }
func (*M) ProtoMessage() {}
+
+// Deprecated: Use M.ProtoReflect.Type instead.
func (*M) Descriptor() ([]byte, []int) {
return xxx_File_imports_fmt_m_proto_rawdesc_gzipped, []int{0}
}
@@ -67,7 +62,7 @@
0x72, 0x74, 0x73, 0x2f, 0x66, 0x6d, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_fmt_m_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_fmt_m_proto_rawdesc)
+var xxx_File_imports_fmt_m_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_fmt_m_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 9fd3c28..bcbf15f 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type E1 int32
const (
@@ -30,18 +23,21 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use E1.Type.Values instead.
var E1_name = map[int32]string{
0: "E1_ZERO",
}
+// Deprecated: Use E1.Type.Values instead.
var E1_value = map[string]int32{
"E1_ZERO": 0,
}
func (x E1) String() string {
- return proto.EnumName(E1_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+// Deprecated: Use E1.Type instead.
func (E1) EnumDescriptor() ([]byte, []int) {
return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{0}
}
@@ -58,6 +54,8 @@
func (m *M1) Reset() { *m = M1{} }
func (m *M1) String() string { return proto.CompactTextString(m) }
func (*M1) ProtoMessage() {}
+
+// Deprecated: Use M1.ProtoReflect.Type instead.
func (*M1) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{0}
}
@@ -93,6 +91,8 @@
func (m *M1_1) Reset() { *m = M1_1{} }
func (m *M1_1) String() string { return proto.CompactTextString(m) }
func (*M1_1) ProtoMessage() {}
+
+// Deprecated: Use M1_1.ProtoReflect.Type instead.
func (*M1_1) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped, []int{1}
}
@@ -145,7 +145,7 @@
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_1_m1_proto_rawdesc)
+var xxx_File_imports_test_a_1_m1_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_a_1_m1_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 cf7dfd2..bd02efc 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M2 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M2) Reset() { *m = M2{} }
func (m *M2) String() string { return proto.CompactTextString(m) }
func (*M2) ProtoMessage() {}
+
+// Deprecated: Use M2.ProtoReflect.Type instead.
func (*M2) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped, []int{0}
}
@@ -68,7 +63,7 @@
0x73, 0x74, 0x5f, 0x61, 0x5f, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_1_m2_proto_rawdesc)
+var xxx_File_imports_test_a_1_m2_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_a_1_m2_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 0d2aa0f..81c27b8 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M3 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M3) Reset() { *m = M3{} }
func (m *M3) String() string { return proto.CompactTextString(m) }
func (*M3) ProtoMessage() {}
+
+// Deprecated: Use M3.ProtoReflect.Type instead.
func (*M3) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped, []int{0}
}
@@ -68,7 +63,7 @@
0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_2_m3_proto_rawdesc)
+var xxx_File_imports_test_a_2_m3_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_a_2_m3_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 758743c..339a836 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M4 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M4) Reset() { *m = M4{} }
func (m *M4) String() string { return proto.CompactTextString(m) }
func (*M4) ProtoMessage() {}
+
+// Deprecated: Use M4.ProtoReflect.Type instead.
func (*M4) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped, []int{0}
}
@@ -68,7 +63,7 @@
0x73, 0x74, 0x5f, 0x61, 0x5f, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_a_2_m4_proto_rawdesc)
+var xxx_File_imports_test_a_2_m4_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_a_2_m4_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 b63c656..021c341 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M1 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M1) Reset() { *m = M1{} }
func (m *M1) String() string { return proto.CompactTextString(m) }
func (*M1) ProtoMessage() {}
+
+// Deprecated: Use M1.ProtoReflect.Type instead.
func (*M1) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped, []int{0}
}
@@ -69,7 +64,7 @@
0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_b_1_m1_proto_rawdesc)
+var xxx_File_imports_test_b_1_m1_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_b_1_m1_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 cfaa827..9d65402 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type M2 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -29,6 +22,8 @@
func (m *M2) Reset() { *m = M2{} }
func (m *M2) String() string { return proto.CompactTextString(m) }
func (*M2) ProtoMessage() {}
+
+// Deprecated: Use M2.ProtoReflect.Type instead.
func (*M2) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped, []int{0}
}
@@ -69,7 +64,7 @@
0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_b_1_m2_proto_rawdesc)
+var xxx_File_imports_test_b_1_m2_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_b_1_m2_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 526527f..e422585 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
@@ -5,19 +5,12 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
test_a_1 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/imports/test_a_1"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type A1M1 struct {
F *test_a_1.M1 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -31,6 +24,8 @@
func (m *A1M1) Reset() { *m = A1M1{} }
func (m *A1M1) String() string { return proto.CompactTextString(m) }
func (*A1M1) ProtoMessage() {}
+
+// Deprecated: Use A1M1.ProtoReflect.Type instead.
func (*A1M1) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped, []int{0}
}
@@ -80,7 +75,7 @@
0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_a1m1_proto_rawdesc)
+var xxx_File_imports_test_import_a1m1_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_import_a1m1_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 328b036..ca8539a 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
@@ -5,19 +5,12 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
test_a_1 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/imports/test_a_1"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type A1M2 struct {
F *test_a_1.M2 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -31,6 +24,8 @@
func (m *A1M2) Reset() { *m = A1M2{} }
func (m *A1M2) String() string { return proto.CompactTextString(m) }
func (*A1M2) ProtoMessage() {}
+
+// Deprecated: Use A1M2.ProtoReflect.Type instead.
func (*A1M2) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped, []int{0}
}
@@ -80,7 +75,7 @@
0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_a1m2_proto_rawdesc)
+var xxx_File_imports_test_import_a1m2_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_import_a1m2_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 bbeac9e..94e725b 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
@@ -5,7 +5,6 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
fmt "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/imports/fmt"
test_a_1 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/imports/test_a_1"
_ "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/imports/test_a_2"
@@ -15,12 +14,6 @@
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type All struct {
Am1 *test_a_1.M1 `protobuf:"bytes,1,opt,name=am1,proto3" json:"am1,omitempty"`
Am2 *test_a_1.M2 `protobuf:"bytes,2,opt,name=am2,proto3" json:"am2,omitempty"`
@@ -38,6 +31,8 @@
func (m *All) Reset() { *m = All{} }
func (m *All) String() string { return proto.CompactTextString(m) }
func (*All) ProtoMessage() {}
+
+// Deprecated: Use All.ProtoReflect.Type instead.
func (*All) Descriptor() ([]byte, []int) {
return xxx_File_imports_test_import_all_proto_rawdesc_gzipped, []int{0}
}
@@ -133,7 +128,7 @@
0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_imports_test_import_all_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_imports_test_import_all_proto_rawdesc)
+var xxx_File_imports_test_import_all_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_imports_test_import_all_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 966589e..e700643 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
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Foo struct {
// Types that are valid to be assigned to Bar:
// *Foo_GetBar
@@ -32,6 +25,8 @@
func (m *Foo) Reset() { *m = Foo{} }
func (m *Foo) String() string { return proto.CompactTextString(m) }
func (*Foo) ProtoMessage() {}
+
+// Deprecated: Use Foo.ProtoReflect.Type instead.
func (*Foo) Descriptor() ([]byte, []int) {
return xxx_File_issue780_oneof_conflict_test_proto_rawdesc_gzipped, []int{0}
}
@@ -100,7 +95,7 @@
0x72, 0x42, 0x05, 0x0a, 0x03, 0x62, 0x61, 0x72,
}
-var xxx_File_issue780_oneof_conflict_test_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_issue780_oneof_conflict_test_proto_rawdesc)
+var xxx_File_issue780_oneof_conflict_test_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_issue780_oneof_conflict_test_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go b/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
index 3f9252a..e77bef4 100644
--- a/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
+++ b/cmd/protoc-gen-go/testdata/nopackage/nopackage.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Enum int32
const (
@@ -30,33 +23,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_value = map[string]int32{
"ZERO": 0,
}
func (x Enum) Enum() *Enum {
- p := new(Enum)
- *p = x
- return p
+ return &x
}
func (x Enum) String() string {
- return proto.EnumName(Enum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *Enum) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(Enum_value, data, "Enum")
+// Deprecated: Do not use.
+func (x *Enum) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = Enum(value)
+ *x = Enum(num)
return nil
}
+// Deprecated: Use Enum.Type instead.
func (Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_nopackage_nopackage_proto_rawdesc_gzipped, []int{0}
}
@@ -75,6 +70,8 @@
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
+
+// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_nopackage_nopackage_proto_rawdesc_gzipped, []int{0}
}
@@ -132,7 +129,7 @@
0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00,
}
-var xxx_File_nopackage_nopackage_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_nopackage_nopackage_proto_rawdesc)
+var xxx_File_nopackage_nopackage_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_nopackage_nopackage_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
index adbde5a..958b1d8 100644
--- a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
// EnumType1 comment.
type EnumType1 int32
@@ -34,35 +27,37 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use EnumType1.Type.Values instead.
var EnumType1_name = map[int32]string{
1: "ONE",
2: "TWO",
}
+// Deprecated: Use EnumType1.Type.Values instead.
var EnumType1_value = map[string]int32{
"ONE": 1,
"TWO": 2,
}
func (x EnumType1) Enum() *EnumType1 {
- p := new(EnumType1)
- *p = x
- return p
+ return &x
}
func (x EnumType1) String() string {
- return proto.EnumName(EnumType1_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *EnumType1) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(EnumType1_value, data, "EnumType1")
+// Deprecated: Do not use.
+func (x *EnumType1) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = EnumType1(value)
+ *x = EnumType1(num)
return nil
}
+// Deprecated: Use EnumType1.Type instead.
func (EnumType1) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0}
}
@@ -81,35 +76,37 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use EnumType2.Type.Values instead.
var EnumType2_name = map[int32]string{
1: "duplicate1",
// Duplicate value: 1: "duplicate2",
}
+// Deprecated: Use EnumType2.Type.Values instead.
var EnumType2_value = map[string]int32{
"duplicate1": 1,
"duplicate2": 1,
}
func (x EnumType2) Enum() *EnumType2 {
- p := new(EnumType2)
- *p = x
- return p
+ return &x
}
func (x EnumType2) String() string {
- return proto.EnumName(EnumType2_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *EnumType2) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(EnumType2_value, data, "EnumType2")
+// Deprecated: Do not use.
+func (x *EnumType2) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = EnumType2(value)
+ *x = EnumType2(num)
return nil
}
+// Deprecated: Use EnumType2.Type instead.
func (EnumType2) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{1}
}
@@ -129,33 +126,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use EnumContainerMessage1_NestedEnumType1A.Type.Values instead.
var EnumContainerMessage1_NestedEnumType1A_name = map[int32]string{
0: "NESTED_1A_VALUE",
}
+// Deprecated: Use EnumContainerMessage1_NestedEnumType1A.Type.Values instead.
var EnumContainerMessage1_NestedEnumType1A_value = map[string]int32{
"NESTED_1A_VALUE": 0,
}
func (x EnumContainerMessage1_NestedEnumType1A) Enum() *EnumContainerMessage1_NestedEnumType1A {
- p := new(EnumContainerMessage1_NestedEnumType1A)
- *p = x
- return p
+ return &x
}
func (x EnumContainerMessage1_NestedEnumType1A) String() string {
- return proto.EnumName(EnumContainerMessage1_NestedEnumType1A_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *EnumContainerMessage1_NestedEnumType1A) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_NestedEnumType1A_value, data, "EnumContainerMessage1_NestedEnumType1A")
+// Deprecated: Do not use.
+func (x *EnumContainerMessage1_NestedEnumType1A) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = EnumContainerMessage1_NestedEnumType1A(value)
+ *x = EnumContainerMessage1_NestedEnumType1A(num)
return nil
}
+// Deprecated: Use EnumContainerMessage1_NestedEnumType1A.Type instead.
func (EnumContainerMessage1_NestedEnumType1A) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -173,33 +172,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use EnumContainerMessage1_NestedEnumType1B.Type.Values instead.
var EnumContainerMessage1_NestedEnumType1B_name = map[int32]string{
0: "NESTED_1B_VALUE",
}
+// Deprecated: Use EnumContainerMessage1_NestedEnumType1B.Type.Values instead.
var EnumContainerMessage1_NestedEnumType1B_value = map[string]int32{
"NESTED_1B_VALUE": 0,
}
func (x EnumContainerMessage1_NestedEnumType1B) Enum() *EnumContainerMessage1_NestedEnumType1B {
- p := new(EnumContainerMessage1_NestedEnumType1B)
- *p = x
- return p
+ return &x
}
func (x EnumContainerMessage1_NestedEnumType1B) String() string {
- return proto.EnumName(EnumContainerMessage1_NestedEnumType1B_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *EnumContainerMessage1_NestedEnumType1B) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_NestedEnumType1B_value, data, "EnumContainerMessage1_NestedEnumType1B")
+// Deprecated: Do not use.
+func (x *EnumContainerMessage1_NestedEnumType1B) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = EnumContainerMessage1_NestedEnumType1B(value)
+ *x = EnumContainerMessage1_NestedEnumType1B(num)
return nil
}
+// Deprecated: Use EnumContainerMessage1_NestedEnumType1B.Type instead.
func (EnumContainerMessage1_NestedEnumType1B) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0, 1}
}
@@ -219,33 +220,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A.Type.Values instead.
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_name = map[int32]string{
0: "NESTED_2A_VALUE",
}
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A.Type.Values instead.
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_value = map[string]int32{
"NESTED_2A_VALUE": 0,
}
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) Enum() *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A {
- p := new(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A)
- *p = x
- return p
+ return &x
}
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) String() string {
- return proto.EnumName(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A_value, data, "EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A")
+// Deprecated: Do not use.
+func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A(value)
+ *x = EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A(num)
return nil
}
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A.Type instead.
func (EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0, 0, 0}
}
@@ -263,33 +266,35 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B.Type.Values instead.
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_name = map[int32]string{
0: "NESTED_2B_VALUE",
}
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B.Type.Values instead.
var EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_value = map[string]int32{
"NESTED_2B_VALUE": 0,
}
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) Enum() *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B {
- p := new(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B)
- *p = x
- return p
+ return &x
}
func (x EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) String() string {
- return proto.EnumName(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B_value, data, "EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B")
+// Deprecated: Do not use.
+func (x *EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B(value)
+ *x = EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B(num)
return nil
}
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B.Type instead.
func (EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2B) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0, 0, 1}
}
@@ -308,6 +313,8 @@
func (m *EnumContainerMessage1) Reset() { *m = EnumContainerMessage1{} }
func (m *EnumContainerMessage1) String() string { return proto.CompactTextString(m) }
func (*EnumContainerMessage1) ProtoMessage() {}
+
+// Deprecated: Use EnumContainerMessage1.ProtoReflect.Type instead.
func (*EnumContainerMessage1) Descriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0}
}
@@ -363,6 +370,8 @@
return proto.CompactTextString(m)
}
func (*EnumContainerMessage1_EnumContainerMessage2) ProtoMessage() {}
+
+// Deprecated: Use EnumContainerMessage1_EnumContainerMessage2.ProtoReflect.Type instead.
func (*EnumContainerMessage1_EnumContainerMessage2) Descriptor() ([]byte, []int) {
return xxx_File_proto2_enum_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -440,7 +449,7 @@
0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32,
}
-var xxx_File_proto2_enum_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto2_enum_proto_rawdesc)
+var xxx_File_proto2_enum_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_proto2_enum_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
index 359cafc..7d03b09 100644
--- a/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/fields.pb.go
@@ -5,19 +5,12 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
math "math"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type FieldTestMessage_Enum int32
const (
@@ -32,35 +25,37 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use FieldTestMessage_Enum.Type.Values instead.
var FieldTestMessage_Enum_name = map[int32]string{
0: "ZERO",
1: "ONE",
}
+// Deprecated: Use FieldTestMessage_Enum.Type.Values instead.
var FieldTestMessage_Enum_value = map[string]int32{
"ZERO": 0,
"ONE": 1,
}
func (x FieldTestMessage_Enum) Enum() *FieldTestMessage_Enum {
- p := new(FieldTestMessage_Enum)
- *p = x
- return p
+ return &x
}
func (x FieldTestMessage_Enum) String() string {
- return proto.EnumName(FieldTestMessage_Enum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
-func (x *FieldTestMessage_Enum) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(FieldTestMessage_Enum_value, data, "FieldTestMessage_Enum")
+// Deprecated: Do not use.
+func (x *FieldTestMessage_Enum) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Type(), b)
if err != nil {
return err
}
- *x = FieldTestMessage_Enum(value)
+ *x = FieldTestMessage_Enum(num)
return nil
}
+// Deprecated: Use FieldTestMessage_Enum.Type instead.
func (FieldTestMessage_Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -183,6 +178,8 @@
func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
func (m *FieldTestMessage) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage.ProtoReflect.Type instead.
func (*FieldTestMessage) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0}
}
@@ -1135,6 +1132,8 @@
func (m *FieldTestMessage_OptionalGroup) Reset() { *m = FieldTestMessage_OptionalGroup{} }
func (m *FieldTestMessage_OptionalGroup) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_OptionalGroup) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage_OptionalGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_OptionalGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -1177,6 +1176,8 @@
func (m *FieldTestMessage_RequiredGroup) Reset() { *m = FieldTestMessage_RequiredGroup{} }
func (m *FieldTestMessage_RequiredGroup) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_RequiredGroup) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage_RequiredGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_RequiredGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0, 1}
}
@@ -1219,6 +1220,8 @@
func (m *FieldTestMessage_RepeatedGroup) Reset() { *m = FieldTestMessage_RepeatedGroup{} }
func (m *FieldTestMessage_RepeatedGroup) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_RepeatedGroup) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage_RepeatedGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_RepeatedGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0, 2}
}
@@ -1261,6 +1264,8 @@
func (m *FieldTestMessage_OneofGroup) Reset() { *m = FieldTestMessage_OneofGroup{} }
func (m *FieldTestMessage_OneofGroup) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_OneofGroup) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage_OneofGroup.ProtoReflect.Type instead.
func (*FieldTestMessage_OneofGroup) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0, 6}
}
@@ -1302,6 +1307,8 @@
func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Message{} }
func (m *FieldTestMessage_Message) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_Message) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage_Message.ProtoReflect.Type instead.
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {
return xxx_File_proto2_fields_proto_rawdesc_gzipped, []int{0, 7}
}
@@ -1712,7 +1719,7 @@
0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32,
}
-var xxx_File_proto2_fields_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto2_fields_proto_rawdesc)
+var xxx_File_proto2_fields_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_proto2_fields_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
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 29ef913..4870f39 100644
--- a/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/nested_messages.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Layer1 struct {
L2 *Layer1_Layer2 `protobuf:"bytes,1,opt,name=l2" json:"l2,omitempty"`
L3 *Layer1_Layer2_Layer3 `protobuf:"bytes,2,opt,name=l3" json:"l3,omitempty"`
@@ -31,6 +24,8 @@
func (m *Layer1) Reset() { *m = Layer1{} }
func (m *Layer1) String() string { return proto.CompactTextString(m) }
func (*Layer1) ProtoMessage() {}
+
+// Deprecated: Use Layer1.ProtoReflect.Type instead.
func (*Layer1) Descriptor() ([]byte, []int) {
return xxx_File_proto2_nested_messages_proto_rawdesc_gzipped, []int{0}
}
@@ -80,6 +75,8 @@
func (m *Layer1_Layer2) Reset() { *m = Layer1_Layer2{} }
func (m *Layer1_Layer2) String() string { return proto.CompactTextString(m) }
func (*Layer1_Layer2) ProtoMessage() {}
+
+// Deprecated: Use Layer1_Layer2.ProtoReflect.Type instead.
func (*Layer1_Layer2) Descriptor() ([]byte, []int) {
return xxx_File_proto2_nested_messages_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -121,6 +118,8 @@
func (m *Layer1_Layer2_Layer3) Reset() { *m = Layer1_Layer2_Layer3{} }
func (m *Layer1_Layer2_Layer3) String() string { return proto.CompactTextString(m) }
func (*Layer1_Layer2_Layer3) ProtoMessage() {}
+
+// Deprecated: Use Layer1_Layer2_Layer3.ProtoReflect.Type instead.
func (*Layer1_Layer2_Layer3) Descriptor() ([]byte, []int) {
return xxx_File_proto2_nested_messages_proto_rawdesc_gzipped, []int{0, 0, 0}
}
@@ -175,7 +174,7 @@
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32,
}
-var xxx_File_proto2_nested_messages_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto2_nested_messages_proto_rawdesc)
+var xxx_File_proto2_nested_messages_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_proto2_nested_messages_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go b/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
index cd10eb4..759bfb8 100644
--- a/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/proto2.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Message struct {
I32 *int32 `protobuf:"varint,1,opt,name=i32" json:"i32,omitempty"`
M *Message `protobuf:"bytes,2,opt,name=m" json:"m,omitempty"`
@@ -31,6 +24,8 @@
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
+
+// Deprecated: Use Message.ProtoReflect.Type instead.
func (*Message) Descriptor() ([]byte, []int) {
return xxx_File_proto2_proto2_proto_rawdesc_gzipped, []int{0}
}
@@ -88,7 +83,7 @@
0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32,
}
-var xxx_File_proto2_proto2_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto2_proto2_proto_rawdesc)
+var xxx_File_proto2_proto2_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_proto2_proto2_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/proto3/enum.pb.go b/cmd/protoc-gen-go/testdata/proto3/enum.pb.go
index 4f6d5e2..30b1304 100644
--- a/cmd/protoc-gen-go/testdata/proto3/enum.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto3/enum.pb.go
@@ -5,17 +5,10 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type Enum int32
const (
@@ -31,12 +24,14 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_name = map[int32]string{
0: "ZERO",
1: "ONE",
2: "TWO",
}
+// Deprecated: Use Enum.Type.Values instead.
var Enum_value = map[string]int32{
"ZERO": 0,
"ONE": 1,
@@ -44,9 +39,10 @@
}
func (x Enum) String() string {
- return proto.EnumName(Enum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+// Deprecated: Use Enum.Type instead.
func (Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto3_enum_proto_rawdesc_gzipped, []int{0}
}
@@ -70,7 +66,7 @@
0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_proto3_enum_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_enum_proto_rawdesc)
+var xxx_File_proto3_enum_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_proto3_enum_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
diff --git a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
index 0715db1..d7aa218 100644
--- a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
@@ -5,18 +5,11 @@
import (
proto "github.com/golang/protobuf/proto"
- protoapi "github.com/golang/protobuf/protoapi"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
reflect "reflect"
)
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
type FieldTestMessage_Enum int32
const (
@@ -30,18 +23,21 @@
return protoreflect.EnumNumber(e)
}
+// Deprecated: Use FieldTestMessage_Enum.Type.Values instead.
var FieldTestMessage_Enum_name = map[int32]string{
0: "ZERO",
}
+// Deprecated: Use FieldTestMessage_Enum.Type.Values instead.
var FieldTestMessage_Enum_value = map[string]int32{
"ZERO": 0,
}
func (x FieldTestMessage_Enum) String() string {
- return proto.EnumName(FieldTestMessage_Enum_name, int32(x))
+ return protoimpl.X.EnumStringOf(x.Type(), protoreflect.EnumNumber(x))
}
+// Deprecated: Use FieldTestMessage_Enum.Type instead.
func (FieldTestMessage_Enum) EnumDescriptor() ([]byte, []int) {
return xxx_File_proto3_fields_proto_rawdesc_gzipped, []int{0, 0}
}
@@ -95,6 +91,8 @@
func (m *FieldTestMessage) Reset() { *m = FieldTestMessage{} }
func (m *FieldTestMessage) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage.ProtoReflect.Type instead.
func (*FieldTestMessage) Descriptor() ([]byte, []int) {
return xxx_File_proto3_fields_proto_rawdesc_gzipped, []int{0}
}
@@ -388,6 +386,8 @@
func (m *FieldTestMessage_Message) Reset() { *m = FieldTestMessage_Message{} }
func (m *FieldTestMessage_Message) String() string { return proto.CompactTextString(m) }
func (*FieldTestMessage_Message) ProtoMessage() {}
+
+// Deprecated: Use FieldTestMessage_Message.ProtoReflect.Type instead.
func (*FieldTestMessage_Message) Descriptor() ([]byte, []int) {
return xxx_File_proto3_fields_proto_rawdesc_gzipped, []int{0, 3}
}
@@ -573,7 +573,7 @@
0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
-var xxx_File_proto3_fields_proto_rawdesc_gzipped = protoapi.CompressGZIP(xxx_File_proto3_fields_proto_rawdesc)
+var xxx_File_proto3_fields_proto_rawdesc_gzipped = protoimpl.X.CompressGZIP(xxx_File_proto3_fields_proto_rawdesc)
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)