mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 22:10:04 +00:00
TUN-8407: Upgrade go to version 1.22.2
This commit is contained in:
40
vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
generated
vendored
40
vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
generated
vendored
@@ -16,7 +16,7 @@ import (
|
||||
"google.golang.org/protobuf/types/descriptorpb"
|
||||
)
|
||||
|
||||
// ToFileDescriptorProto copies a protoreflect.FileDescriptor into a
|
||||
// ToFileDescriptorProto copies a [protoreflect.FileDescriptor] into a
|
||||
// google.protobuf.FileDescriptorProto message.
|
||||
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {
|
||||
p := &descriptorpb.FileDescriptorProto{
|
||||
@@ -70,13 +70,23 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD
|
||||
for i, exts := 0, file.Extensions(); i < exts.Len(); i++ {
|
||||
p.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))
|
||||
}
|
||||
if syntax := file.Syntax(); syntax != protoreflect.Proto2 {
|
||||
if syntax := file.Syntax(); syntax != protoreflect.Proto2 && syntax.IsValid() {
|
||||
p.Syntax = proto.String(file.Syntax().String())
|
||||
}
|
||||
if file.Syntax() == protoreflect.Editions {
|
||||
desc := file
|
||||
if fileImportDesc, ok := file.(protoreflect.FileImport); ok {
|
||||
desc = fileImportDesc.FileDescriptor
|
||||
}
|
||||
|
||||
if editionsInterface, ok := desc.(interface{ Edition() int32 }); ok {
|
||||
p.Edition = descriptorpb.Edition(editionsInterface.Edition()).Enum()
|
||||
}
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// ToDescriptorProto copies a protoreflect.MessageDescriptor into a
|
||||
// ToDescriptorProto copies a [protoreflect.MessageDescriptor] into a
|
||||
// google.protobuf.DescriptorProto message.
|
||||
func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {
|
||||
p := &descriptorpb.DescriptorProto{
|
||||
@@ -119,7 +129,7 @@ func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.Des
|
||||
return p
|
||||
}
|
||||
|
||||
// ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a
|
||||
// ToFieldDescriptorProto copies a [protoreflect.FieldDescriptor] into a
|
||||
// google.protobuf.FieldDescriptorProto message.
|
||||
func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {
|
||||
p := &descriptorpb.FieldDescriptorProto{
|
||||
@@ -153,6 +163,18 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi
|
||||
if field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {
|
||||
p.Proto3Optional = proto.Bool(true)
|
||||
}
|
||||
if field.Syntax() == protoreflect.Editions {
|
||||
// Editions have no group keyword, this type is only set so that downstream users continue
|
||||
// treating this as delimited encoding.
|
||||
if p.GetType() == descriptorpb.FieldDescriptorProto_TYPE_GROUP {
|
||||
p.Type = descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum()
|
||||
}
|
||||
// Editions have no required keyword, this label is only set so that downstream users continue
|
||||
// treating it as required.
|
||||
if p.GetLabel() == descriptorpb.FieldDescriptorProto_LABEL_REQUIRED {
|
||||
p.Label = descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum()
|
||||
}
|
||||
}
|
||||
if field.HasDefault() {
|
||||
def, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)
|
||||
if err != nil && field.DefaultEnumValue() != nil {
|
||||
@@ -168,7 +190,7 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi
|
||||
return p
|
||||
}
|
||||
|
||||
// ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a
|
||||
// ToOneofDescriptorProto copies a [protoreflect.OneofDescriptor] into a
|
||||
// google.protobuf.OneofDescriptorProto message.
|
||||
func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto {
|
||||
return &descriptorpb.OneofDescriptorProto{
|
||||
@@ -177,7 +199,7 @@ func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.On
|
||||
}
|
||||
}
|
||||
|
||||
// ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a
|
||||
// ToEnumDescriptorProto copies a [protoreflect.EnumDescriptor] into a
|
||||
// google.protobuf.EnumDescriptorProto message.
|
||||
func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto {
|
||||
p := &descriptorpb.EnumDescriptorProto{
|
||||
@@ -200,7 +222,7 @@ func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumD
|
||||
return p
|
||||
}
|
||||
|
||||
// ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a
|
||||
// ToEnumValueDescriptorProto copies a [protoreflect.EnumValueDescriptor] into a
|
||||
// google.protobuf.EnumValueDescriptorProto message.
|
||||
func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto {
|
||||
return &descriptorpb.EnumValueDescriptorProto{
|
||||
@@ -210,7 +232,7 @@ func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descrip
|
||||
}
|
||||
}
|
||||
|
||||
// ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a
|
||||
// ToServiceDescriptorProto copies a [protoreflect.ServiceDescriptor] into a
|
||||
// google.protobuf.ServiceDescriptorProto message.
|
||||
func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto {
|
||||
p := &descriptorpb.ServiceDescriptorProto{
|
||||
@@ -223,7 +245,7 @@ func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descripto
|
||||
return p
|
||||
}
|
||||
|
||||
// ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a
|
||||
// ToMethodDescriptorProto copies a [protoreflect.MethodDescriptor] into a
|
||||
// google.protobuf.MethodDescriptorProto message.
|
||||
func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {
|
||||
p := &descriptorpb.MethodDescriptorProto{
|
||||
|
Reference in New Issue
Block a user