Joe Tsai 5681bb2587 protogen: use _protoFile suffix for file descriptor variable
A "_ProtoFile" suffix can potentially conflict with a sub-message named
"ProtoFile" nested within a message that matches the camel-cased
form of the basename of the .proto source file.

Avoid unlikely conflicts and rename this to use a "_protoFile" suffix,
which can never conflict except with an enum value that is also named
"protoFile" (which is a violation of the style guide).

Change-Id: Ie9d22f9f741a63021b8f76906b20c6c2f599885b
Reviewed-on: https://go-review.googlesource.com/c/157218
Reviewed-by: Damien Neil <dneil@google.com>
2019-01-14 20:23:59 +00:00

568 lines
17 KiB
Go

// Code generated by protoc-gen-go. DO NOT EDIT.
// source: reflect/protoregistry/testprotos/test.proto
package testprotos
import (
proto "github.com/golang/protobuf/proto"
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
prototype "github.com/golang/protobuf/v2/reflect/prototype"
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 Enum1 int32
const (
Enum1_ONE Enum1 = 1
)
func (e Enum1) Type() protoreflect.EnumType {
return xxx_Test_protoFile_EnumTypes[0]
}
func (e Enum1) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(e)
}
var Enum1_name = map[int32]string{
1: "ONE",
}
var Enum1_value = map[string]int32{
"ONE": 1,
}
func (x Enum1) Enum() *Enum1 {
p := new(Enum1)
*p = x
return p
}
func (x Enum1) String() string {
return proto.EnumName(Enum1_name, int32(x))
}
func (x *Enum1) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(Enum1_value, data, "Enum1")
if err != nil {
return err
}
*x = Enum1(value)
return nil
}
func (Enum1) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{0}
}
type Enum2 int32
const (
Enum2_UNO Enum2 = 1
)
func (e Enum2) Type() protoreflect.EnumType {
return xxx_Test_protoFile_EnumTypes[1]
}
func (e Enum2) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(e)
}
var Enum2_name = map[int32]string{
1: "UNO",
}
var Enum2_value = map[string]int32{
"UNO": 1,
}
func (x Enum2) Enum() *Enum2 {
p := new(Enum2)
*p = x
return p
}
func (x Enum2) String() string {
return proto.EnumName(Enum2_name, int32(x))
}
func (x *Enum2) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(Enum2_value, data, "Enum2")
if err != nil {
return err
}
*x = Enum2(value)
return nil
}
func (Enum2) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{1}
}
type Enum3 int32
const (
Enum3_YI Enum3 = 1
)
func (e Enum3) Type() protoreflect.EnumType {
return xxx_Test_protoFile_EnumTypes[2]
}
func (e Enum3) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(e)
}
var Enum3_name = map[int32]string{
1: "YI",
}
var Enum3_value = map[string]int32{
"YI": 1,
}
func (x Enum3) Enum() *Enum3 {
p := new(Enum3)
*p = x
return p
}
func (x Enum3) String() string {
return proto.EnumName(Enum3_name, int32(x))
}
func (x *Enum3) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(Enum3_value, data, "Enum3")
if err != nil {
return err
}
*x = Enum3(value)
return nil
}
func (Enum3) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{2}
}
type Message1 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
proto.XXX_InternalExtensions `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
type xxx_Message1 struct{ m *Message1 }
func (m *Message1) ProtoReflect() protoreflect.Message {
return xxx_Message1{m}
}
func (m xxx_Message1) Type() protoreflect.MessageType {
return xxx_Test_protoFile_MessageTypes[0].Type
}
func (m xxx_Message1) KnownFields() protoreflect.KnownFields {
return xxx_Test_protoFile_MessageTypes[0].KnownFieldsOf(m.m)
}
func (m xxx_Message1) UnknownFields() protoreflect.UnknownFields {
return xxx_Test_protoFile_MessageTypes[0].UnknownFieldsOf(m.m)
}
func (m xxx_Message1) Interface() protoreflect.ProtoMessage {
return m.m
}
func (m *Message1) Reset() { *m = Message1{} }
func (m *Message1) String() string { return proto.CompactTextString(m) }
func (*Message1) ProtoMessage() {}
func (*Message1) Descriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{0}
}
var extRange_Message1 = []proto.ExtensionRange{
{Start: 10, End: 536870911},
}
func (*Message1) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_Message1
}
func (m *Message1) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Message1.Unmarshal(m, b)
}
func (m *Message1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Message1.Marshal(b, m, deterministic)
}
func (m *Message1) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message1.Merge(m, src)
}
func (m *Message1) XXX_Size() int {
return xxx_messageInfo_Message1.Size(m)
}
func (m *Message1) XXX_DiscardUnknown() {
xxx_messageInfo_Message1.DiscardUnknown(m)
}
var xxx_messageInfo_Message1 proto.InternalMessageInfo
type Message2 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
type xxx_Message2 struct{ m *Message2 }
func (m *Message2) ProtoReflect() protoreflect.Message {
return xxx_Message2{m}
}
func (m xxx_Message2) Type() protoreflect.MessageType {
return xxx_Test_protoFile_MessageTypes[1].Type
}
func (m xxx_Message2) KnownFields() protoreflect.KnownFields {
return xxx_Test_protoFile_MessageTypes[1].KnownFieldsOf(m.m)
}
func (m xxx_Message2) UnknownFields() protoreflect.UnknownFields {
return xxx_Test_protoFile_MessageTypes[1].UnknownFieldsOf(m.m)
}
func (m xxx_Message2) Interface() protoreflect.ProtoMessage {
return m.m
}
func (m *Message2) Reset() { *m = Message2{} }
func (m *Message2) String() string { return proto.CompactTextString(m) }
func (*Message2) ProtoMessage() {}
func (*Message2) Descriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{1}
}
func (m *Message2) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Message2.Unmarshal(m, b)
}
func (m *Message2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Message2.Marshal(b, m, deterministic)
}
func (m *Message2) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message2.Merge(m, src)
}
func (m *Message2) XXX_Size() int {
return xxx_messageInfo_Message2.Size(m)
}
func (m *Message2) XXX_DiscardUnknown() {
xxx_messageInfo_Message2.DiscardUnknown(m)
}
var xxx_messageInfo_Message2 proto.InternalMessageInfo
type Message3 struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
type xxx_Message3 struct{ m *Message3 }
func (m *Message3) ProtoReflect() protoreflect.Message {
return xxx_Message3{m}
}
func (m xxx_Message3) Type() protoreflect.MessageType {
return xxx_Test_protoFile_MessageTypes[2].Type
}
func (m xxx_Message3) KnownFields() protoreflect.KnownFields {
return xxx_Test_protoFile_MessageTypes[2].KnownFieldsOf(m.m)
}
func (m xxx_Message3) UnknownFields() protoreflect.UnknownFields {
return xxx_Test_protoFile_MessageTypes[2].UnknownFieldsOf(m.m)
}
func (m xxx_Message3) Interface() protoreflect.ProtoMessage {
return m.m
}
func (m *Message3) Reset() { *m = Message3{} }
func (m *Message3) String() string { return proto.CompactTextString(m) }
func (*Message3) ProtoMessage() {}
func (*Message3) Descriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{2}
}
func (m *Message3) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Message3.Unmarshal(m, b)
}
func (m *Message3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Message3.Marshal(b, m, deterministic)
}
func (m *Message3) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message3.Merge(m, src)
}
func (m *Message3) XXX_Size() int {
return xxx_messageInfo_Message3.Size(m)
}
func (m *Message3) XXX_DiscardUnknown() {
xxx_messageInfo_Message3.DiscardUnknown(m)
}
var xxx_messageInfo_Message3 proto.InternalMessageInfo
type Message4 struct {
BoolField *bool `protobuf:"varint,30,opt,name=bool_field,json=boolField" json:"bool_field,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
type xxx_Message4 struct{ m *Message4 }
func (m *Message4) ProtoReflect() protoreflect.Message {
return xxx_Message4{m}
}
func (m xxx_Message4) Type() protoreflect.MessageType {
return xxx_Test_protoFile_MessageTypes[3].Type
}
func (m xxx_Message4) KnownFields() protoreflect.KnownFields {
return xxx_Test_protoFile_MessageTypes[3].KnownFieldsOf(m.m)
}
func (m xxx_Message4) UnknownFields() protoreflect.UnknownFields {
return xxx_Test_protoFile_MessageTypes[3].UnknownFieldsOf(m.m)
}
func (m xxx_Message4) Interface() protoreflect.ProtoMessage {
return m.m
}
func (m *Message4) Reset() { *m = Message4{} }
func (m *Message4) String() string { return proto.CompactTextString(m) }
func (*Message4) ProtoMessage() {}
func (*Message4) Descriptor() ([]byte, []int) {
return fileDescriptor_3628d63611f7063d, []int{3}
}
func (m *Message4) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Message4.Unmarshal(m, b)
}
func (m *Message4) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Message4.Marshal(b, m, deterministic)
}
func (m *Message4) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message4.Merge(m, src)
}
func (m *Message4) XXX_Size() int {
return xxx_messageInfo_Message4.Size(m)
}
func (m *Message4) XXX_DiscardUnknown() {
xxx_messageInfo_Message4.DiscardUnknown(m)
}
var xxx_messageInfo_Message4 proto.InternalMessageInfo
func (m *Message4) GetBoolField() bool {
if m != nil && m.BoolField != nil {
return *m.BoolField
}
return false
}
var E_StringField = &proto.ExtensionDesc{
ExtendedType: (*Message1)(nil),
ExtensionType: (*string)(nil),
Field: 11,
Name: "testprotos.string_field",
Tag: "bytes,11,opt,name=string_field",
Filename: "reflect/protoregistry/testprotos/test.proto",
}
var E_EnumField = &proto.ExtensionDesc{
ExtendedType: (*Message1)(nil),
ExtensionType: (*Enum1)(nil),
Field: 12,
Name: "testprotos.enum_field",
Tag: "varint,12,opt,name=enum_field,enum=testprotos.Enum1",
Filename: "reflect/protoregistry/testprotos/test.proto",
}
var E_MessageField = &proto.ExtensionDesc{
ExtendedType: (*Message1)(nil),
ExtensionType: (*Message2)(nil),
Field: 13,
Name: "testprotos.message_field",
Tag: "bytes,13,opt,name=message_field",
Filename: "reflect/protoregistry/testprotos/test.proto",
}
var E_Message4_MessageField = &proto.ExtensionDesc{
ExtendedType: (*Message1)(nil),
ExtensionType: (*Message2)(nil),
Field: 21,
Name: "testprotos.Message4.message_field",
Tag: "bytes,21,opt,name=message_field",
Filename: "reflect/protoregistry/testprotos/test.proto",
}
var E_Message4_EnumField = &proto.ExtensionDesc{
ExtendedType: (*Message1)(nil),
ExtensionType: (*Enum1)(nil),
Field: 22,
Name: "testprotos.Message4.enum_field",
Tag: "varint,22,opt,name=enum_field,enum=testprotos.Enum1",
Filename: "reflect/protoregistry/testprotos/test.proto",
}
var E_Message4_StringField = &proto.ExtensionDesc{
ExtendedType: (*Message1)(nil),
ExtensionType: (*string)(nil),
Field: 23,
Name: "testprotos.Message4.string_field",
Tag: "bytes,23,opt,name=string_field",
Filename: "reflect/protoregistry/testprotos/test.proto",
}
func init() {
proto.RegisterFile("reflect/protoregistry/testprotos/test.proto", fileDescriptor_3628d63611f7063d)
proto.RegisterEnum("testprotos.Enum1", Enum1_name, Enum1_value)
proto.RegisterEnum("testprotos.Enum2", Enum2_name, Enum2_value)
proto.RegisterEnum("testprotos.Enum3", Enum3_name, Enum3_value)
proto.RegisterType((*Message1)(nil), "testprotos.Message1")
proto.RegisterType((*Message2)(nil), "testprotos.Message2")
proto.RegisterType((*Message3)(nil), "testprotos.Message3")
proto.RegisterType((*Message4)(nil), "testprotos.Message4")
proto.RegisterExtension(E_StringField)
proto.RegisterExtension(E_EnumField)
proto.RegisterExtension(E_MessageField)
proto.RegisterExtension(E_Message4_MessageField)
proto.RegisterExtension(E_Message4_EnumField)
proto.RegisterExtension(E_Message4_StringField)
}
var fileDescriptor_3628d63611f7063d = []byte{
// 304 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0x4a, 0x4d, 0xcb,
0x49, 0x4d, 0x2e, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x2f, 0x4a, 0x4d, 0xcf, 0x2c, 0x2e, 0x29,
0xaa, 0xd4, 0x2f, 0x49, 0x2d, 0x2e, 0x01, 0x8b, 0x14, 0x83, 0x99, 0x7a, 0x60, 0xb6, 0x10, 0x17,
0x42, 0x58, 0x49, 0x84, 0x8b, 0xc3, 0x37, 0xb5, 0xb8, 0x38, 0x31, 0x3d, 0xd5, 0x50, 0x8b, 0x83,
0x83, 0x4b, 0xa0, 0xa1, 0xa1, 0xa1, 0x81, 0x49, 0x89, 0x0b, 0x2e, 0x6a, 0x84, 0xc4, 0x36, 0x56,
0xfa, 0xcd, 0x08, 0xe7, 0x98, 0x08, 0xc9, 0x72, 0x71, 0x25, 0xe5, 0xe7, 0xe7, 0xc4, 0xa7, 0x65,
0xa6, 0xe6, 0xa4, 0x48, 0xc8, 0x29, 0x30, 0x6a, 0x70, 0x04, 0x71, 0x82, 0x44, 0xdc, 0x40, 0x02,
0x46, 0xfe, 0x5c, 0xbc, 0xb9, 0x10, 0xa5, 0x10, 0x15, 0x42, 0x22, 0x7a, 0x08, 0x7b, 0xf5, 0x60,
0x96, 0x4a, 0x88, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x61, 0x93, 0x33, 0x0a, 0xe2, 0x81, 0x1a, 0x00,
0x31, 0xd0, 0x8d, 0x8b, 0x2b, 0x35, 0xaf, 0x34, 0x17, 0xaf, 0x69, 0x62, 0x0a, 0x8c, 0x1a, 0x7c,
0x46, 0x82, 0xc8, 0x72, 0xae, 0x79, 0xa5, 0xb9, 0x86, 0x41, 0x9c, 0x20, 0xad, 0x10, 0x73, 0xcc,
0xb9, 0x78, 0x8a, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0xf1, 0x9a, 0x24, 0xae, 0xc0, 0xa8, 0xc1, 0x19,
0xc4, 0x0d, 0x51, 0x09, 0xd6, 0xa8, 0x25, 0xc0, 0xc5, 0x0a, 0x36, 0x4c, 0x88, 0x9d, 0x8b, 0xd9,
0xdf, 0xcf, 0x55, 0x80, 0x11, 0x26, 0x62, 0x04, 0x12, 0x09, 0xf5, 0xf3, 0x17, 0x60, 0xd4, 0xe2,
0x87, 0x88, 0x18, 0x0b, 0xb1, 0x71, 0x31, 0x45, 0x7a, 0x0a, 0x30, 0x5a, 0x11, 0x67, 0x1b, 0x37,
0x86, 0x6d, 0x56, 0xc4, 0x78, 0x97, 0x87, 0xb0, 0x77, 0xad, 0x88, 0x8c, 0x07, 0x5e, 0x62, 0xe3,
0xc1, 0xc9, 0x21, 0xca, 0x2e, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f,
0x3d, 0x3f, 0x27, 0x31, 0x2f, 0x1d, 0x92, 0xee, 0x92, 0x4a, 0xd3, 0xf4, 0xcb, 0x8c, 0xf4, 0x09,
0xa5, 0x45, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, 0x64, 0x81, 0x59, 0xae, 0x02, 0x00, 0x00,
}
func init() {
xxx_Test_protoFile_FileDesc.Enums = xxx_Test_protoFile_EnumDescs[0:3]
xxx_Test_protoFile_FileDesc.Messages = xxx_Test_protoFile_MessageDescs[0:4]
var err error
Test_protoFile, err = prototype.NewFile(&xxx_Test_protoFile_FileDesc)
if err != nil {
panic(err)
}
}
const _ = protoimpl.EnforceVersion(protoimpl.Version - 0)
var Test_protoFile protoreflect.FileDescriptor
var xxx_Test_protoFile_FileDesc = prototype.File{
Syntax: protoreflect.Proto2,
Path: "reflect/protoregistry/testprotos/test.proto",
Package: "testprotos",
}
var xxx_Test_protoFile_EnumTypes = [3]protoreflect.EnumType{
prototype.GoEnum(
xxx_Test_protoFile_EnumDescs[0].Reference(),
func(_ protoreflect.EnumType, n protoreflect.EnumNumber) protoreflect.Enum {
return Enum1(n)
},
),
prototype.GoEnum(
xxx_Test_protoFile_EnumDescs[1].Reference(),
func(_ protoreflect.EnumType, n protoreflect.EnumNumber) protoreflect.Enum {
return Enum2(n)
},
),
prototype.GoEnum(
xxx_Test_protoFile_EnumDescs[2].Reference(),
func(_ protoreflect.EnumType, n protoreflect.EnumNumber) protoreflect.Enum {
return Enum3(n)
},
),
}
var xxx_Test_protoFile_EnumDescs = [3]prototype.Enum{
{
Name: "Enum1",
Values: []prototype.EnumValue{
{Name: "ONE", Number: 1},
},
},
{
Name: "Enum2",
Values: []prototype.EnumValue{
{Name: "UNO", Number: 1},
},
},
{
Name: "Enum3",
Values: []prototype.EnumValue{
{Name: "YI", Number: 1},
},
},
}
var xxx_Test_protoFile_MessageTypes = [4]protoimpl.MessageType{
{Type: prototype.GoMessage(
xxx_Test_protoFile_MessageDescs[0].Reference(),
func(protoreflect.MessageType) protoreflect.Message {
return xxx_Message1{new(Message1)}
},
)},
{Type: prototype.GoMessage(
xxx_Test_protoFile_MessageDescs[1].Reference(),
func(protoreflect.MessageType) protoreflect.Message {
return xxx_Message2{new(Message2)}
},
)},
{Type: prototype.GoMessage(
xxx_Test_protoFile_MessageDescs[2].Reference(),
func(protoreflect.MessageType) protoreflect.Message {
return xxx_Message3{new(Message3)}
},
)},
{Type: prototype.GoMessage(
xxx_Test_protoFile_MessageDescs[3].Reference(),
func(protoreflect.MessageType) protoreflect.Message {
return xxx_Message4{new(Message4)}
},
)},
}
var xxx_Test_protoFile_MessageDescs = [4]prototype.Message{
{
Name: "Message1",
ExtensionRanges: [][2]protoreflect.FieldNumber{{10, 536870912}},
},
{
Name: "Message2",
},
{
Name: "Message3",
},
{
Name: "Message4",
Fields: []prototype.Field{
{
Name: "bool_field",
Number: 30,
Cardinality: protoreflect.Optional,
Kind: protoreflect.BoolKind,
JSONName: "boolField",
IsPacked: prototype.False,
},
},
},
}