update vendor
This commit is contained in:
parent
824f46979b
commit
8675bc4b7a
328 changed files with 27166 additions and 6537 deletions
70
vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
generated
vendored
70
vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
generated
vendored
|
|
@ -3,16 +3,19 @@
|
|||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package protodesc provides functionality for converting
|
||||
// FileDescriptorProto messages to/from protoreflect.FileDescriptor values.
|
||||
// FileDescriptorProto messages to/from [protoreflect.FileDescriptor] values.
|
||||
//
|
||||
// The google.protobuf.FileDescriptorProto is a protobuf message that describes
|
||||
// the type information for a .proto file in a form that is easily serializable.
|
||||
// The protoreflect.FileDescriptor is a more structured representation of
|
||||
// The [protoreflect.FileDescriptor] is a more structured representation of
|
||||
// the FileDescriptorProto message where references and remote dependencies
|
||||
// can be directly followed.
|
||||
package protodesc
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/internal/editionssupport"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
|
|
@ -24,11 +27,11 @@ import (
|
|||
"google.golang.org/protobuf/types/descriptorpb"
|
||||
)
|
||||
|
||||
// Resolver is the resolver used by NewFile to resolve dependencies.
|
||||
// Resolver is the resolver used by [NewFile] to resolve dependencies.
|
||||
// The enums and messages provided must belong to some parent file,
|
||||
// which is also registered.
|
||||
//
|
||||
// It is implemented by protoregistry.Files.
|
||||
// It is implemented by [protoregistry.Files].
|
||||
type Resolver interface {
|
||||
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||
|
|
@ -61,19 +64,19 @@ type FileOptions struct {
|
|||
AllowUnresolvable bool
|
||||
}
|
||||
|
||||
// NewFile creates a new protoreflect.FileDescriptor from the provided
|
||||
// file descriptor message. See FileOptions.New for more information.
|
||||
// NewFile creates a new [protoreflect.FileDescriptor] from the provided
|
||||
// file descriptor message. See [FileOptions.New] for more information.
|
||||
func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) {
|
||||
return FileOptions{}.New(fd, r)
|
||||
}
|
||||
|
||||
// NewFiles creates a new protoregistry.Files from the provided
|
||||
// FileDescriptorSet message. See FileOptions.NewFiles for more information.
|
||||
// NewFiles creates a new [protoregistry.Files] from the provided
|
||||
// FileDescriptorSet message. See [FileOptions.NewFiles] for more information.
|
||||
func NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) {
|
||||
return FileOptions{}.NewFiles(fd)
|
||||
}
|
||||
|
||||
// New creates a new protoreflect.FileDescriptor from the provided
|
||||
// New creates a new [protoreflect.FileDescriptor] from the provided
|
||||
// file descriptor message. The file must represent a valid proto file according
|
||||
// to protobuf semantics. The returned descriptor is a deep copy of the input.
|
||||
//
|
||||
|
|
@ -91,8 +94,13 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
|||
switch fd.GetSyntax() {
|
||||
case "proto2", "":
|
||||
f.L1.Syntax = protoreflect.Proto2
|
||||
f.L1.Edition = filedesc.EditionProto2
|
||||
case "proto3":
|
||||
f.L1.Syntax = protoreflect.Proto3
|
||||
f.L1.Edition = filedesc.EditionProto3
|
||||
case "editions":
|
||||
f.L1.Syntax = protoreflect.Editions
|
||||
f.L1.Edition = fromEditionProto(fd.GetEdition())
|
||||
default:
|
||||
return nil, errors.New("invalid syntax: %q", fd.GetSyntax())
|
||||
}
|
||||
|
|
@ -100,6 +108,13 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
|||
if f.L1.Path == "" {
|
||||
return nil, errors.New("file path must be populated")
|
||||
}
|
||||
if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < editionssupport.Minimum || fd.GetEdition() > editionssupport.Maximum) {
|
||||
// Allow cmd/protoc-gen-go/testdata to use any edition for easier
|
||||
// testing of upcoming edition features.
|
||||
if !strings.HasPrefix(fd.GetName(), "cmd/protoc-gen-go/testdata/") {
|
||||
return nil, errors.New("use of edition %v not yet supported by the Go Protobuf runtime", fd.GetEdition())
|
||||
}
|
||||
}
|
||||
f.L1.Package = protoreflect.FullName(fd.GetPackage())
|
||||
if !f.L1.Package.IsValid() && f.L1.Package != "" {
|
||||
return nil, errors.New("invalid package: %q", f.L1.Package)
|
||||
|
|
@ -108,6 +123,7 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
|||
opts = proto.Clone(opts).(*descriptorpb.FileOptions)
|
||||
f.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||
}
|
||||
initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures())
|
||||
|
||||
f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency()))
|
||||
for _, i := range fd.GetPublicDependency() {
|
||||
|
|
@ -116,17 +132,11 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
|||
}
|
||||
f.L2.Imports[i].IsPublic = true
|
||||
}
|
||||
for _, i := range fd.GetWeakDependency() {
|
||||
if !(0 <= i && int(i) < len(f.L2.Imports)) || f.L2.Imports[i].IsWeak {
|
||||
return nil, errors.New("invalid or duplicate weak import index: %d", i)
|
||||
}
|
||||
f.L2.Imports[i].IsWeak = true
|
||||
}
|
||||
imps := importSet{f.Path(): true}
|
||||
for i, path := range fd.GetDependency() {
|
||||
imp := &f.L2.Imports[i]
|
||||
f, err := r.FindFileByPath(path)
|
||||
if err == protoregistry.NotFound && (o.AllowUnresolvable || imp.IsWeak) {
|
||||
if err == protoregistry.NotFound && o.AllowUnresolvable {
|
||||
f = filedesc.PlaceholderFile(path)
|
||||
} else if err != nil {
|
||||
return nil, errors.New("could not resolve import %q: %v", path, err)
|
||||
|
|
@ -142,6 +152,28 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
|||
imp := &f.L2.Imports[i]
|
||||
imps.importPublic(imp.Imports())
|
||||
}
|
||||
if len(fd.GetOptionDependency()) > 0 {
|
||||
optionImports := make(filedesc.FileImports, len(fd.GetOptionDependency()))
|
||||
for i, path := range fd.GetOptionDependency() {
|
||||
imp := &optionImports[i]
|
||||
f, err := r.FindFileByPath(path)
|
||||
if err == protoregistry.NotFound {
|
||||
// We always allow option imports to be unresolvable.
|
||||
f = filedesc.PlaceholderFile(path)
|
||||
} else if err != nil {
|
||||
return nil, errors.New("could not resolve import %q: %v", path, err)
|
||||
}
|
||||
imp.FileDescriptor = f
|
||||
|
||||
if imps[imp.Path()] {
|
||||
return nil, errors.New("already imported %q", path)
|
||||
}
|
||||
imps[imp.Path()] = true
|
||||
}
|
||||
f.L2.OptionImports = func() protoreflect.FileImports {
|
||||
return &optionImports
|
||||
}
|
||||
}
|
||||
|
||||
// Handle source locations.
|
||||
f.L2.Locations.File = f
|
||||
|
|
@ -210,10 +242,10 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
|||
if err := validateEnumDeclarations(f.L1.Enums.List, fd.GetEnumType()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateMessageDeclarations(f.L1.Messages.List, fd.GetMessageType()); err != nil {
|
||||
if err := validateMessageDeclarations(f, f.L1.Messages.List, fd.GetMessageType()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := validateExtensionDeclarations(f.L1.Extensions.List, fd.GetExtension()); err != nil {
|
||||
if err := validateExtensionDeclarations(f, f.L1.Extensions.List, fd.GetExtension()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +263,7 @@ func (is importSet) importPublic(imps protoreflect.FileImports) {
|
|||
}
|
||||
}
|
||||
|
||||
// NewFiles creates a new protoregistry.Files from the provided
|
||||
// NewFiles creates a new [protoregistry.Files] from the provided
|
||||
// FileDescriptorSet message. The descriptor set must include only
|
||||
// valid files according to protobuf semantics. The returned descriptors
|
||||
// are a deep copy of the input.
|
||||
|
|
|
|||
50
vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
generated
vendored
50
vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
generated
vendored
|
|
@ -28,6 +28,8 @@ func (r descsByName) initEnumDeclarations(eds []*descriptorpb.EnumDescriptorProt
|
|||
opts = proto.Clone(opts).(*descriptorpb.EnumOptions)
|
||||
e.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||
}
|
||||
e.L1.EditionFeatures = mergeEditionFeatures(parent, ed.GetOptions().GetFeatures())
|
||||
e.L1.Visibility = int32(ed.GetVisibility())
|
||||
for _, s := range ed.GetReservedName() {
|
||||
e.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s))
|
||||
}
|
||||
|
|
@ -68,6 +70,8 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt
|
|||
if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures())
|
||||
m.L1.Visibility = int32(md.GetVisibility())
|
||||
if opts := md.GetOptions(); opts != nil {
|
||||
opts = proto.Clone(opts).(*descriptorpb.MessageOptions)
|
||||
m.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||
|
|
@ -114,6 +118,27 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt
|
|||
return ms, nil
|
||||
}
|
||||
|
||||
// canBePacked returns whether the field can use packed encoding:
|
||||
// https://protobuf.dev/programming-guides/encoding/#packed
|
||||
func canBePacked(fd *descriptorpb.FieldDescriptorProto) bool {
|
||||
if fd.GetLabel() != descriptorpb.FieldDescriptorProto_LABEL_REPEATED {
|
||||
return false // not a repeated field
|
||||
}
|
||||
|
||||
switch protoreflect.Kind(fd.GetType()) {
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
return false // not a scalar type field
|
||||
|
||||
case protoreflect.StringKind, protoreflect.BytesKind:
|
||||
// string and bytes can explicitly not be declared as packed,
|
||||
// see https://protobuf.dev/programming-guides/encoding/#packed
|
||||
return false
|
||||
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (fs []filedesc.Field, err error) {
|
||||
fs = make([]filedesc.Field, len(fds)) // allocate up-front to ensure stable pointers
|
||||
for i, fd := range fds {
|
||||
|
|
@ -121,13 +146,15 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc
|
|||
if f.L0, err = r.makeBase(f, parent, fd.GetName(), i, sb); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures())
|
||||
f.L1.IsProto3Optional = fd.GetProto3Optional()
|
||||
if opts := fd.GetOptions(); opts != nil {
|
||||
opts = proto.Clone(opts).(*descriptorpb.FieldOptions)
|
||||
f.L1.Options = func() protoreflect.ProtoMessage { return opts }
|
||||
f.L1.IsWeak = opts.GetWeak()
|
||||
f.L1.HasPacked = opts.Packed != nil
|
||||
f.L1.IsPacked = opts.GetPacked()
|
||||
f.L1.IsLazy = opts.GetLazy()
|
||||
if opts.Packed != nil {
|
||||
f.L1.EditionFeatures.IsPacked = opts.GetPacked()
|
||||
}
|
||||
}
|
||||
f.L1.Number = protoreflect.FieldNumber(fd.GetNumber())
|
||||
f.L1.Cardinality = protoreflect.Cardinality(fd.GetLabel())
|
||||
|
|
@ -137,6 +164,14 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc
|
|||
if fd.JsonName != nil {
|
||||
f.L1.StringName.InitJSON(fd.GetJsonName())
|
||||
}
|
||||
|
||||
if f.L1.EditionFeatures.IsLegacyRequired {
|
||||
f.L1.Cardinality = protoreflect.Required
|
||||
}
|
||||
|
||||
if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded {
|
||||
f.L1.Kind = protoreflect.GroupKind
|
||||
}
|
||||
}
|
||||
return fs, nil
|
||||
}
|
||||
|
|
@ -148,6 +183,7 @@ func (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDesc
|
|||
if o.L0, err = r.makeBase(o, parent, od.GetName(), i, sb); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
o.L1.EditionFeatures = mergeEditionFeatures(parent, od.GetOptions().GetFeatures())
|
||||
if opts := od.GetOptions(); opts != nil {
|
||||
opts = proto.Clone(opts).(*descriptorpb.OneofOptions)
|
||||
o.L1.Options = func() protoreflect.ProtoMessage { return opts }
|
||||
|
|
@ -164,10 +200,13 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript
|
|||
if x.L0, err = r.makeBase(x, parent, xd.GetName(), i, sb); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x.L1.EditionFeatures = mergeEditionFeatures(parent, xd.GetOptions().GetFeatures())
|
||||
if opts := xd.GetOptions(); opts != nil {
|
||||
opts = proto.Clone(opts).(*descriptorpb.FieldOptions)
|
||||
x.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||
x.L2.IsPacked = opts.GetPacked()
|
||||
if opts.Packed != nil {
|
||||
x.L1.EditionFeatures.IsPacked = opts.GetPacked()
|
||||
}
|
||||
}
|
||||
x.L1.Number = protoreflect.FieldNumber(xd.GetNumber())
|
||||
x.L1.Cardinality = protoreflect.Cardinality(xd.GetLabel())
|
||||
|
|
@ -177,6 +216,9 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript
|
|||
if xd.JsonName != nil {
|
||||
x.L2.StringName.InitJSON(xd.GetJsonName())
|
||||
}
|
||||
if x.L1.Kind == protoreflect.MessageKind && x.L1.EditionFeatures.IsDelimitedEncoded {
|
||||
x.L1.Kind = protoreflect.GroupKind
|
||||
}
|
||||
}
|
||||
return xs, nil
|
||||
}
|
||||
|
|
|
|||
35
vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go
generated
vendored
35
vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go
generated
vendored
|
|
@ -43,9 +43,14 @@ func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*desc
|
|||
o.L1.Fields.List = append(o.L1.Fields.List, f)
|
||||
}
|
||||
|
||||
if f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName()), f.IsWeak()); err != nil {
|
||||
if f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName())); err != nil {
|
||||
return errors.New("message field %q cannot resolve type: %v", f.FullName(), err)
|
||||
}
|
||||
if f.L1.Kind == protoreflect.GroupKind && (f.IsMap() || f.IsMapEntry()) {
|
||||
// A map field might inherit delimited encoding from a file-wide default feature.
|
||||
// But maps never actually use delimited encoding. (At least for now...)
|
||||
f.L1.Kind = protoreflect.MessageKind
|
||||
}
|
||||
if fd.DefaultValue != nil {
|
||||
v, ev, err := unmarshalDefault(fd.GetDefaultValue(), f, r.allowUnresolvable)
|
||||
if err != nil {
|
||||
|
|
@ -68,10 +73,10 @@ func (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*desc
|
|||
func (r *resolver) resolveExtensionDependencies(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) (err error) {
|
||||
for i, xd := range xds {
|
||||
x := &xs[i]
|
||||
if x.L1.Extendee, err = r.findMessageDescriptor(x.Parent().FullName(), partialName(xd.GetExtendee()), false); err != nil {
|
||||
if x.L1.Extendee, err = r.findMessageDescriptor(x.Parent().FullName(), partialName(xd.GetExtendee())); err != nil {
|
||||
return errors.New("extension field %q cannot resolve extendee: %v", x.FullName(), err)
|
||||
}
|
||||
if x.L1.Kind, x.L2.Enum, x.L2.Message, err = r.findTarget(x.Kind(), x.Parent().FullName(), partialName(xd.GetTypeName()), false); err != nil {
|
||||
if x.L1.Kind, x.L2.Enum, x.L2.Message, err = r.findTarget(x.Kind(), x.Parent().FullName(), partialName(xd.GetTypeName())); err != nil {
|
||||
return errors.New("extension field %q cannot resolve type: %v", x.FullName(), err)
|
||||
}
|
||||
if xd.DefaultValue != nil {
|
||||
|
|
@ -90,11 +95,11 @@ func (r *resolver) resolveServiceDependencies(ss []filedesc.Service, sds []*desc
|
|||
s := &ss[i]
|
||||
for j, md := range sd.GetMethod() {
|
||||
m := &s.L2.Methods.List[j]
|
||||
m.L1.Input, err = r.findMessageDescriptor(m.Parent().FullName(), partialName(md.GetInputType()), false)
|
||||
m.L1.Input, err = r.findMessageDescriptor(m.Parent().FullName(), partialName(md.GetInputType()))
|
||||
if err != nil {
|
||||
return errors.New("service method %q cannot resolve input: %v", m.FullName(), err)
|
||||
}
|
||||
m.L1.Output, err = r.findMessageDescriptor(s.FullName(), partialName(md.GetOutputType()), false)
|
||||
m.L1.Output, err = r.findMessageDescriptor(s.FullName(), partialName(md.GetOutputType()))
|
||||
if err != nil {
|
||||
return errors.New("service method %q cannot resolve output: %v", m.FullName(), err)
|
||||
}
|
||||
|
|
@ -106,16 +111,16 @@ func (r *resolver) resolveServiceDependencies(ss []filedesc.Service, sds []*desc
|
|||
// findTarget finds an enum or message descriptor if k is an enum, message,
|
||||
// group, or unknown. If unknown, and the name could be resolved, the kind
|
||||
// returned kind is set based on the type of the resolved descriptor.
|
||||
func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) {
|
||||
func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) {
|
||||
switch k {
|
||||
case protoreflect.EnumKind:
|
||||
ed, err := r.findEnumDescriptor(scope, ref, isWeak)
|
||||
ed, err := r.findEnumDescriptor(scope, ref)
|
||||
if err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
return k, ed, nil, nil
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
md, err := r.findMessageDescriptor(scope, ref, isWeak)
|
||||
md, err := r.findMessageDescriptor(scope, ref)
|
||||
if err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
|
|
@ -124,7 +129,7 @@ func (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName,
|
|||
// Handle unspecified kinds (possible with parsers that operate
|
||||
// on a per-file basis without knowledge of dependencies).
|
||||
d, err := r.findDescriptor(scope, ref)
|
||||
if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {
|
||||
if err == protoregistry.NotFound && r.allowUnresolvable {
|
||||
return k, filedesc.PlaceholderEnum(ref.FullName()), filedesc.PlaceholderMessage(ref.FullName()), nil
|
||||
} else if err == protoregistry.NotFound {
|
||||
return 0, nil, nil, errors.New("%q not found", ref.FullName())
|
||||
|
|
@ -201,9 +206,9 @@ func (r *resolver) findDescriptor(scope protoreflect.FullName, ref partialName)
|
|||
}
|
||||
}
|
||||
|
||||
func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.EnumDescriptor, error) {
|
||||
func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialName) (protoreflect.EnumDescriptor, error) {
|
||||
d, err := r.findDescriptor(scope, ref)
|
||||
if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {
|
||||
if err == protoregistry.NotFound && r.allowUnresolvable {
|
||||
return filedesc.PlaceholderEnum(ref.FullName()), nil
|
||||
} else if err == protoregistry.NotFound {
|
||||
return nil, errors.New("%q not found", ref.FullName())
|
||||
|
|
@ -217,9 +222,9 @@ func (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialNa
|
|||
return ed, nil
|
||||
}
|
||||
|
||||
func (r *resolver) findMessageDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.MessageDescriptor, error) {
|
||||
func (r *resolver) findMessageDescriptor(scope protoreflect.FullName, ref partialName) (protoreflect.MessageDescriptor, error) {
|
||||
d, err := r.findDescriptor(scope, ref)
|
||||
if err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {
|
||||
if err == protoregistry.NotFound && r.allowUnresolvable {
|
||||
return filedesc.PlaceholderMessage(ref.FullName()), nil
|
||||
} else if err == protoregistry.NotFound {
|
||||
return nil, errors.New("%q not found", ref.FullName())
|
||||
|
|
@ -276,8 +281,8 @@ func unmarshalDefault(s string, fd protoreflect.FieldDescriptor, allowUnresolvab
|
|||
} else if err != nil {
|
||||
return v, ev, err
|
||||
}
|
||||
if fd.Syntax() == protoreflect.Proto3 {
|
||||
return v, ev, errors.New("cannot be specified under proto3 semantics")
|
||||
if !fd.HasPresence() {
|
||||
return v, ev, errors.New("cannot be specified with implicit field presence")
|
||||
}
|
||||
if fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind || fd.Cardinality() == protoreflect.Repeated {
|
||||
return v, ev, errors.New("cannot be specified on composite types")
|
||||
|
|
|
|||
85
vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
generated
vendored
85
vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
generated
vendored
|
|
@ -45,11 +45,11 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri
|
|||
if allowAlias && !foundAlias {
|
||||
return errors.New("enum %q allows aliases, but none were found", e.FullName())
|
||||
}
|
||||
if e.Syntax() == protoreflect.Proto3 {
|
||||
if !e.IsClosed() {
|
||||
if v := e.Values().Get(0); v.Number() != 0 {
|
||||
return errors.New("enum %q using proto3 semantics must have zero number for the first value", v.FullName())
|
||||
return errors.New("enum %q using open semantics must have zero number for the first value", v.FullName())
|
||||
}
|
||||
// Verify that value names in proto3 do not conflict if the
|
||||
// Verify that value names in open enums do not conflict if the
|
||||
// case-insensitive prefix is removed.
|
||||
// See protoc v3.8.0: src/google/protobuf/descriptor.cc:4991-5055
|
||||
names := map[string]protoreflect.EnumValueDescriptor{}
|
||||
|
|
@ -58,7 +58,7 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri
|
|||
v1 := e.Values().Get(i)
|
||||
s := strs.EnumValueName(strs.TrimEnumPrefix(string(v1.Name()), prefix))
|
||||
if v2, ok := names[s]; ok && v1.Number() != v2.Number() {
|
||||
return errors.New("enum %q using proto3 semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name())
|
||||
return errors.New("enum %q using open semantics has conflict: %q with %q", e.FullName(), v1.Name(), v2.Name())
|
||||
}
|
||||
names[s] = v1
|
||||
}
|
||||
|
|
@ -80,7 +80,9 @@ func validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescri
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error {
|
||||
func validateMessageDeclarations(file *filedesc.File, ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error {
|
||||
// There are a few limited exceptions only for proto3
|
||||
isProto3 := file.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3)
|
||||
for i, md := range mds {
|
||||
m := &ms[i]
|
||||
|
||||
|
|
@ -107,25 +109,13 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
|
|||
if isMessageSet && !flags.ProtoLegacy {
|
||||
return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName())
|
||||
}
|
||||
if isMessageSet && (m.Syntax() != protoreflect.Proto2 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {
|
||||
if isMessageSet && (isProto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {
|
||||
return errors.New("message %q is an invalid proto1 MessageSet", m.FullName())
|
||||
}
|
||||
if m.Syntax() == protoreflect.Proto3 {
|
||||
if isProto3 {
|
||||
if m.ExtensionRanges().Len() > 0 {
|
||||
return errors.New("message %q using proto3 semantics cannot have extension ranges", m.FullName())
|
||||
}
|
||||
// Verify that field names in proto3 do not conflict if lowercased
|
||||
// with all underscores removed.
|
||||
// See protoc v3.8.0: src/google/protobuf/descriptor.cc:5830-5847
|
||||
names := map[string]protoreflect.FieldDescriptor{}
|
||||
for i := 0; i < m.Fields().Len(); i++ {
|
||||
f1 := m.Fields().Get(i)
|
||||
s := strings.Replace(strings.ToLower(string(f1.Name())), "_", "", -1)
|
||||
if f2, ok := names[s]; ok {
|
||||
return errors.New("message %q using proto3 semantics has conflict: %q with %q", m.FullName(), f1.Name(), f2.Name())
|
||||
}
|
||||
names[s] = f1
|
||||
}
|
||||
}
|
||||
|
||||
for j, fd := range md.GetField() {
|
||||
|
|
@ -149,7 +139,7 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
|
|||
return errors.New("message field %q may not have extendee: %q", f.FullName(), fd.GetExtendee())
|
||||
}
|
||||
if f.L1.IsProto3Optional {
|
||||
if f.Syntax() != protoreflect.Proto3 {
|
||||
if !isProto3 {
|
||||
return errors.New("message field %q under proto3 optional semantics must be specified in the proto3 syntax", f.FullName())
|
||||
}
|
||||
if f.Cardinality() != protoreflect.Optional {
|
||||
|
|
@ -159,29 +149,26 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
|
|||
return errors.New("message field %q under proto3 optional semantics must be within a single element oneof", f.FullName())
|
||||
}
|
||||
}
|
||||
if f.IsWeak() && !flags.ProtoLegacy {
|
||||
return errors.New("message field %q is a weak field, which is a legacy proto1 feature that is no longer supported", f.FullName())
|
||||
}
|
||||
if f.IsWeak() && (f.Syntax() != protoreflect.Proto2 || !isOptionalMessage(f) || f.ContainingOneof() != nil) {
|
||||
return errors.New("message field %q may only be weak for an optional message", f.FullName())
|
||||
}
|
||||
if f.IsPacked() && !isPackable(f) {
|
||||
return errors.New("message field %q is not packable", f.FullName())
|
||||
}
|
||||
if err := checkValidGroup(f); err != nil {
|
||||
if err := checkValidGroup(file, f); err != nil {
|
||||
return errors.New("message field %q is an invalid group: %v", f.FullName(), err)
|
||||
}
|
||||
if err := checkValidMap(f); err != nil {
|
||||
return errors.New("message field %q is an invalid map: %v", f.FullName(), err)
|
||||
}
|
||||
if f.Syntax() == protoreflect.Proto3 {
|
||||
if isProto3 {
|
||||
if f.Cardinality() == protoreflect.Required {
|
||||
return errors.New("message field %q using proto3 semantics cannot be required", f.FullName())
|
||||
}
|
||||
if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().Syntax() != protoreflect.Proto3 {
|
||||
return errors.New("message field %q using proto3 semantics may only depend on a proto3 enum", f.FullName())
|
||||
if f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().IsClosed() {
|
||||
return errors.New("message field %q using proto3 semantics may only depend on open enums", f.FullName())
|
||||
}
|
||||
}
|
||||
if f.Cardinality() == protoreflect.Optional && !f.HasPresence() && f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().IsClosed() {
|
||||
return errors.New("message field %q with implicit presence may only use open enums", f.FullName())
|
||||
}
|
||||
}
|
||||
seenSynthetic := false // synthetic oneofs for proto3 optional must come after real oneofs
|
||||
for j := range md.GetOneofDecl() {
|
||||
|
|
@ -206,26 +193,23 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
|
|||
if f.Cardinality() != protoreflect.Optional {
|
||||
return errors.New("message field %q belongs in a oneof and must be optional", f.FullName())
|
||||
}
|
||||
if f.IsWeak() {
|
||||
return errors.New("message field %q belongs in a oneof and must not be a weak reference", f.FullName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := validateEnumDeclarations(m.L1.Enums.List, md.GetEnumType()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateMessageDeclarations(m.L1.Messages.List, md.GetNestedType()); err != nil {
|
||||
if err := validateMessageDeclarations(file, m.L1.Messages.List, md.GetNestedType()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateExtensionDeclarations(m.L1.Extensions.List, md.GetExtension()); err != nil {
|
||||
if err := validateExtensionDeclarations(file, m.L1.Extensions.List, md.GetExtension()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error {
|
||||
func validateExtensionDeclarations(f *filedesc.File, xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error {
|
||||
for i, xd := range xds {
|
||||
x := &xs[i]
|
||||
// NOTE: Avoid using the IsValid method since extensions to MessageSet
|
||||
|
|
@ -261,19 +245,16 @@ func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.
|
|||
return errors.New("extension field %q has an invalid number: %d", x.FullName(), x.Number())
|
||||
}
|
||||
}
|
||||
if xd.GetOptions().GetWeak() {
|
||||
return errors.New("extension field %q cannot be a weak reference", x.FullName())
|
||||
}
|
||||
if x.IsPacked() && !isPackable(x) {
|
||||
return errors.New("extension field %q is not packable", x.FullName())
|
||||
}
|
||||
if err := checkValidGroup(x); err != nil {
|
||||
if err := checkValidGroup(f, x); err != nil {
|
||||
return errors.New("extension field %q is an invalid group: %v", x.FullName(), err)
|
||||
}
|
||||
if md := x.Message(); md != nil && md.IsMapEntry() {
|
||||
return errors.New("extension field %q cannot be a map entry", x.FullName())
|
||||
}
|
||||
if x.Syntax() == protoreflect.Proto3 {
|
||||
if f.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3) {
|
||||
switch x.ContainingMessage().FullName() {
|
||||
case (*descriptorpb.FileOptions)(nil).ProtoReflect().Descriptor().FullName():
|
||||
case (*descriptorpb.EnumOptions)(nil).ProtoReflect().Descriptor().FullName():
|
||||
|
|
@ -309,21 +290,25 @@ func isPackable(fd protoreflect.FieldDescriptor) bool {
|
|||
|
||||
// checkValidGroup reports whether fd is a valid group according to the same
|
||||
// rules that protoc imposes.
|
||||
func checkValidGroup(fd protoreflect.FieldDescriptor) error {
|
||||
func checkValidGroup(f *filedesc.File, fd protoreflect.FieldDescriptor) error {
|
||||
md := fd.Message()
|
||||
switch {
|
||||
case fd.Kind() != protoreflect.GroupKind:
|
||||
return nil
|
||||
case fd.Syntax() != protoreflect.Proto2:
|
||||
return errors.New("invalid under proto2 semantics")
|
||||
case f.L1.Edition == fromEditionProto(descriptorpb.Edition_EDITION_PROTO3):
|
||||
return errors.New("invalid under proto3 semantics")
|
||||
case md == nil || md.IsPlaceholder():
|
||||
return errors.New("message must be resolvable")
|
||||
case fd.FullName().Parent() != md.FullName().Parent():
|
||||
return errors.New("message and field must be declared in the same scope")
|
||||
case !unicode.IsUpper(rune(md.Name()[0])):
|
||||
return errors.New("message name must start with an uppercase")
|
||||
case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))):
|
||||
return errors.New("field name must be lowercased form of the message name")
|
||||
}
|
||||
if f.L1.Edition < fromEditionProto(descriptorpb.Edition_EDITION_2023) {
|
||||
switch {
|
||||
case fd.FullName().Parent() != md.FullName().Parent():
|
||||
return errors.New("message and field must be declared in the same scope")
|
||||
case !unicode.IsUpper(rune(md.Name()[0])):
|
||||
return errors.New("message name must start with an uppercase")
|
||||
case fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))):
|
||||
return errors.New("field name must be lowercased form of the message name")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
181
vendor/google.golang.org/protobuf/reflect/protodesc/editions.go
generated
vendored
Normal file
181
vendor/google.golang.org/protobuf/reflect/protodesc/editions.go
generated
vendored
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package protodesc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/internal/editiondefaults"
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/types/descriptorpb"
|
||||
"google.golang.org/protobuf/types/gofeaturespb"
|
||||
)
|
||||
|
||||
var defaults = &descriptorpb.FeatureSetDefaults{}
|
||||
var defaultsCacheMu sync.Mutex
|
||||
var defaultsCache = make(map[filedesc.Edition]*descriptorpb.FeatureSet)
|
||||
|
||||
func init() {
|
||||
err := proto.Unmarshal(editiondefaults.Defaults, defaults)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "unmarshal editions defaults: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func fromEditionProto(epb descriptorpb.Edition) filedesc.Edition {
|
||||
return filedesc.Edition(epb)
|
||||
}
|
||||
|
||||
func toEditionProto(ed filedesc.Edition) descriptorpb.Edition {
|
||||
switch ed {
|
||||
case filedesc.EditionUnknown:
|
||||
return descriptorpb.Edition_EDITION_UNKNOWN
|
||||
case filedesc.EditionProto2:
|
||||
return descriptorpb.Edition_EDITION_PROTO2
|
||||
case filedesc.EditionProto3:
|
||||
return descriptorpb.Edition_EDITION_PROTO3
|
||||
case filedesc.Edition2023:
|
||||
return descriptorpb.Edition_EDITION_2023
|
||||
case filedesc.Edition2024:
|
||||
return descriptorpb.Edition_EDITION_2024
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown value for edition: %v", ed))
|
||||
}
|
||||
}
|
||||
|
||||
func getFeatureSetFor(ed filedesc.Edition) *descriptorpb.FeatureSet {
|
||||
defaultsCacheMu.Lock()
|
||||
defer defaultsCacheMu.Unlock()
|
||||
if def, ok := defaultsCache[ed]; ok {
|
||||
return def
|
||||
}
|
||||
edpb := toEditionProto(ed)
|
||||
if defaults.GetMinimumEdition() > edpb || defaults.GetMaximumEdition() < edpb {
|
||||
// This should never happen protodesc.(FileOptions).New would fail when
|
||||
// initializing the file descriptor.
|
||||
// This most likely means the embedded defaults were not updated.
|
||||
fmt.Fprintf(os.Stderr, "internal error: unsupported edition %v (did you forget to update the embedded defaults (i.e. the bootstrap descriptor proto)?)\n", edpb)
|
||||
os.Exit(1)
|
||||
}
|
||||
fsed := defaults.GetDefaults()[0]
|
||||
// Using a linear search for now.
|
||||
// Editions are guaranteed to be sorted and thus we could use a binary search.
|
||||
// Given that there are only a handful of editions (with one more per year)
|
||||
// there is not much reason to use a binary search.
|
||||
for _, def := range defaults.GetDefaults() {
|
||||
if def.GetEdition() <= edpb {
|
||||
fsed = def
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
fs := proto.Clone(fsed.GetFixedFeatures()).(*descriptorpb.FeatureSet)
|
||||
proto.Merge(fs, fsed.GetOverridableFeatures())
|
||||
defaultsCache[ed] = fs
|
||||
return fs
|
||||
}
|
||||
|
||||
// mergeEditionFeatures merges the parent and child feature sets. This function
|
||||
// should be used when initializing Go descriptors from descriptor protos which
|
||||
// is why the parent is a filedesc.EditionsFeatures (Go representation) while
|
||||
// the child is a descriptorproto.FeatureSet (protoc representation).
|
||||
// Any feature set by the child overwrites what is set by the parent.
|
||||
func mergeEditionFeatures(parentDesc protoreflect.Descriptor, child *descriptorpb.FeatureSet) filedesc.EditionFeatures {
|
||||
var parentFS filedesc.EditionFeatures
|
||||
switch p := parentDesc.(type) {
|
||||
case *filedesc.File:
|
||||
parentFS = p.L1.EditionFeatures
|
||||
case *filedesc.Message:
|
||||
parentFS = p.L1.EditionFeatures
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown parent type %T", parentDesc))
|
||||
}
|
||||
if child == nil {
|
||||
return parentFS
|
||||
}
|
||||
if fp := child.FieldPresence; fp != nil {
|
||||
parentFS.IsFieldPresence = *fp == descriptorpb.FeatureSet_LEGACY_REQUIRED ||
|
||||
*fp == descriptorpb.FeatureSet_EXPLICIT
|
||||
parentFS.IsLegacyRequired = *fp == descriptorpb.FeatureSet_LEGACY_REQUIRED
|
||||
}
|
||||
if et := child.EnumType; et != nil {
|
||||
parentFS.IsOpenEnum = *et == descriptorpb.FeatureSet_OPEN
|
||||
}
|
||||
|
||||
if rfe := child.RepeatedFieldEncoding; rfe != nil {
|
||||
parentFS.IsPacked = *rfe == descriptorpb.FeatureSet_PACKED
|
||||
}
|
||||
|
||||
if utf8val := child.Utf8Validation; utf8val != nil {
|
||||
parentFS.IsUTF8Validated = *utf8val == descriptorpb.FeatureSet_VERIFY
|
||||
}
|
||||
|
||||
if me := child.MessageEncoding; me != nil {
|
||||
parentFS.IsDelimitedEncoded = *me == descriptorpb.FeatureSet_DELIMITED
|
||||
}
|
||||
|
||||
if jf := child.JsonFormat; jf != nil {
|
||||
parentFS.IsJSONCompliant = *jf == descriptorpb.FeatureSet_ALLOW
|
||||
}
|
||||
|
||||
// We must not use proto.GetExtension(child, gofeaturespb.E_Go)
|
||||
// because that only works for messages we generated, but not for
|
||||
// dynamicpb messages. See golang/protobuf#1669.
|
||||
//
|
||||
// Further, we harden this code against adversarial inputs: a
|
||||
// service which accepts descriptors from a possibly malicious
|
||||
// source shouldn't crash.
|
||||
goFeatures := child.ProtoReflect().Get(gofeaturespb.E_Go.TypeDescriptor())
|
||||
if !goFeatures.IsValid() {
|
||||
return parentFS
|
||||
}
|
||||
gf, ok := goFeatures.Interface().(protoreflect.Message)
|
||||
if !ok {
|
||||
return parentFS
|
||||
}
|
||||
// gf.Interface() could be *dynamicpb.Message or *gofeaturespb.GoFeatures.
|
||||
fields := gf.Descriptor().Fields()
|
||||
|
||||
if fd := fields.ByNumber(genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number); fd != nil &&
|
||||
!fd.IsList() &&
|
||||
fd.Kind() == protoreflect.BoolKind &&
|
||||
gf.Has(fd) {
|
||||
parentFS.GenerateLegacyUnmarshalJSON = gf.Get(fd).Bool()
|
||||
}
|
||||
|
||||
if fd := fields.ByNumber(genid.GoFeatures_StripEnumPrefix_field_number); fd != nil &&
|
||||
!fd.IsList() &&
|
||||
fd.Kind() == protoreflect.EnumKind &&
|
||||
gf.Has(fd) {
|
||||
parentFS.StripEnumPrefix = int(gf.Get(fd).Enum())
|
||||
}
|
||||
|
||||
if fd := fields.ByNumber(genid.GoFeatures_ApiLevel_field_number); fd != nil &&
|
||||
!fd.IsList() &&
|
||||
fd.Kind() == protoreflect.EnumKind &&
|
||||
gf.Has(fd) {
|
||||
parentFS.APILevel = int(gf.Get(fd).Enum())
|
||||
}
|
||||
|
||||
return parentFS
|
||||
}
|
||||
|
||||
// initFileDescFromFeatureSet initializes editions related fields in fd based
|
||||
// on fs. If fs is nil it is assumed to be an empty featureset and all fields
|
||||
// will be initialized with the appropriate default. fd.L1.Edition must be set
|
||||
// before calling this function.
|
||||
func initFileDescFromFeatureSet(fd *filedesc.File, fs *descriptorpb.FeatureSet) {
|
||||
dfs := getFeatureSetFor(fd.L1.Edition)
|
||||
// initialize the featureset with the defaults
|
||||
fd.L1.EditionFeatures = mergeEditionFeatures(fd, dfs)
|
||||
// overwrite any options explicitly specified
|
||||
fd.L1.EditionFeatures = mergeEditionFeatures(fd, fs)
|
||||
}
|
||||
70
vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
generated
vendored
70
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{
|
||||
|
|
@ -32,9 +32,6 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD
|
|||
if imp.IsPublic {
|
||||
p.PublicDependency = append(p.PublicDependency, int32(i))
|
||||
}
|
||||
if imp.IsWeak {
|
||||
p.WeakDependency = append(p.WeakDependency, int32(i))
|
||||
}
|
||||
}
|
||||
for i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {
|
||||
loc := locs.Get(i)
|
||||
|
|
@ -70,13 +67,34 @@ 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())
|
||||
}
|
||||
desc := file
|
||||
if fileImportDesc, ok := file.(protoreflect.FileImport); ok {
|
||||
desc = fileImportDesc.FileDescriptor
|
||||
}
|
||||
if file.Syntax() == protoreflect.Editions {
|
||||
if editionsInterface, ok := desc.(interface{ Edition() int32 }); ok {
|
||||
p.Edition = descriptorpb.Edition(editionsInterface.Edition()).Enum()
|
||||
}
|
||||
}
|
||||
type hasOptionImports interface {
|
||||
OptionImports() protoreflect.FileImports
|
||||
}
|
||||
if opts, ok := desc.(hasOptionImports); ok {
|
||||
if optionImports := opts.OptionImports(); optionImports.Len() > 0 {
|
||||
optionDeps := make([]string, optionImports.Len())
|
||||
for i := range optionImports.Len() {
|
||||
optionDeps[i] = optionImports.Get(i).Path()
|
||||
}
|
||||
p.OptionDependency = optionDeps
|
||||
}
|
||||
}
|
||||
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{
|
||||
|
|
@ -116,10 +134,18 @@ func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.Des
|
|||
for i, names := 0, message.ReservedNames(); i < names.Len(); i++ {
|
||||
p.ReservedName = append(p.ReservedName, string(names.Get(i)))
|
||||
}
|
||||
type hasVisibility interface {
|
||||
Visibility() int32
|
||||
}
|
||||
if vis, ok := message.(hasVisibility); ok {
|
||||
if visibility := vis.Visibility(); visibility > 0 {
|
||||
p.Visibility = descriptorpb.SymbolVisibility(visibility).Enum()
|
||||
}
|
||||
}
|
||||
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 +179,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 +206,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 +215,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{
|
||||
|
|
@ -197,10 +235,18 @@ func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumD
|
|||
for i, names := 0, enum.ReservedNames(); i < names.Len(); i++ {
|
||||
p.ReservedName = append(p.ReservedName, string(names.Get(i)))
|
||||
}
|
||||
type hasVisibility interface {
|
||||
Visibility() int32
|
||||
}
|
||||
if vis, ok := enum.(hasVisibility); ok {
|
||||
if visibility := vis.Visibility(); visibility > 0 {
|
||||
p.Visibility = descriptorpb.SymbolVisibility(visibility).Enum()
|
||||
}
|
||||
}
|
||||
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 +256,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 +269,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{
|
||||
|
|
|
|||
10
vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go
generated
vendored
10
vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go
generated
vendored
|
|
@ -23,6 +23,7 @@ type (
|
|||
Unmarshal func(unmarshalInput) (unmarshalOutput, error)
|
||||
Merge func(mergeInput) mergeOutput
|
||||
CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)
|
||||
Equal func(equalInput) equalOutput
|
||||
}
|
||||
supportFlags = uint64
|
||||
sizeInput = struct {
|
||||
|
|
@ -75,4 +76,13 @@ type (
|
|||
checkInitializedOutput = struct {
|
||||
pragma.NoUnkeyedLiterals
|
||||
}
|
||||
equalInput = struct {
|
||||
pragma.NoUnkeyedLiterals
|
||||
MessageA Message
|
||||
MessageB Message
|
||||
}
|
||||
equalOutput = struct {
|
||||
pragma.NoUnkeyedLiterals
|
||||
Equal bool
|
||||
}
|
||||
)
|
||||
|
|
|
|||
87
vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
generated
vendored
87
vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
generated
vendored
|
|
@ -10,46 +10,46 @@
|
|||
//
|
||||
// # Protocol Buffer Descriptors
|
||||
//
|
||||
// Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor)
|
||||
// Protobuf descriptors (e.g., [EnumDescriptor] or [MessageDescriptor])
|
||||
// are immutable objects that represent protobuf type information.
|
||||
// They are wrappers around the messages declared in descriptor.proto.
|
||||
// Protobuf descriptors alone lack any information regarding Go types.
|
||||
//
|
||||
// Enums and messages generated by this module implement Enum and ProtoMessage,
|
||||
// Enums and messages generated by this module implement [Enum] and [ProtoMessage],
|
||||
// where the Descriptor and ProtoReflect.Descriptor accessors respectively
|
||||
// return the protobuf descriptor for the values.
|
||||
//
|
||||
// The protobuf descriptor interfaces are not meant to be implemented by
|
||||
// user code since they might need to be extended in the future to support
|
||||
// additions to the protobuf language.
|
||||
// The "google.golang.org/protobuf/reflect/protodesc" package converts between
|
||||
// The [google.golang.org/protobuf/reflect/protodesc] package converts between
|
||||
// google.protobuf.DescriptorProto messages and protobuf descriptors.
|
||||
//
|
||||
// # Go Type Descriptors
|
||||
//
|
||||
// A type descriptor (e.g., EnumType or MessageType) is a constructor for
|
||||
// A type descriptor (e.g., [EnumType] or [MessageType]) is a constructor for
|
||||
// a concrete Go type that represents the associated protobuf descriptor.
|
||||
// There is commonly a one-to-one relationship between protobuf descriptors and
|
||||
// Go type descriptors, but it can potentially be a one-to-many relationship.
|
||||
//
|
||||
// Enums and messages generated by this module implement Enum and ProtoMessage,
|
||||
// Enums and messages generated by this module implement [Enum] and [ProtoMessage],
|
||||
// where the Type and ProtoReflect.Type accessors respectively
|
||||
// return the protobuf descriptor for the values.
|
||||
//
|
||||
// The "google.golang.org/protobuf/types/dynamicpb" package can be used to
|
||||
// The [google.golang.org/protobuf/types/dynamicpb] package can be used to
|
||||
// create Go type descriptors from protobuf descriptors.
|
||||
//
|
||||
// # Value Interfaces
|
||||
//
|
||||
// The Enum and Message interfaces provide a reflective view over an
|
||||
// The [Enum] and [Message] interfaces provide a reflective view over an
|
||||
// enum or message instance. For enums, it provides the ability to retrieve
|
||||
// the enum value number for any concrete enum type. For messages, it provides
|
||||
// the ability to access or manipulate fields of the message.
|
||||
//
|
||||
// To convert a proto.Message to a protoreflect.Message, use the
|
||||
// To convert a [google.golang.org/protobuf/proto.Message] to a [protoreflect.Message], use the
|
||||
// former's ProtoReflect method. Since the ProtoReflect method is new to the
|
||||
// v2 message interface, it may not be present on older message implementations.
|
||||
// The "github.com/golang/protobuf/proto".MessageReflect function can be used
|
||||
// The [github.com/golang/protobuf/proto.MessageReflect] function can be used
|
||||
// to obtain a reflective view on older messages.
|
||||
//
|
||||
// # Relationships
|
||||
|
|
@ -71,12 +71,12 @@
|
|||
// │ │
|
||||
// └────────────────── Type() ───────┘
|
||||
//
|
||||
// • An EnumType describes a concrete Go enum type.
|
||||
// • An [EnumType] describes a concrete Go enum type.
|
||||
// It has an EnumDescriptor and can construct an Enum instance.
|
||||
//
|
||||
// • An EnumDescriptor describes an abstract protobuf enum type.
|
||||
// • An [EnumDescriptor] describes an abstract protobuf enum type.
|
||||
//
|
||||
// • An Enum is a concrete enum instance. Generated enums implement Enum.
|
||||
// • An [Enum] is a concrete enum instance. Generated enums implement Enum.
|
||||
//
|
||||
// ┌──────────────── New() ─────────────────┐
|
||||
// │ │
|
||||
|
|
@ -90,24 +90,26 @@
|
|||
// │ │
|
||||
// └─────────────────── Type() ─────────┘
|
||||
//
|
||||
// • A MessageType describes a concrete Go message type.
|
||||
// It has a MessageDescriptor and can construct a Message instance.
|
||||
// Just as how Go's reflect.Type is a reflective description of a Go type,
|
||||
// a MessageType is a reflective description of a Go type for a protobuf message.
|
||||
// • A [MessageType] describes a concrete Go message type.
|
||||
// It has a [MessageDescriptor] and can construct a [Message] instance.
|
||||
// Just as how Go's [reflect.Type] is a reflective description of a Go type,
|
||||
// a [MessageType] is a reflective description of a Go type for a protobuf message.
|
||||
//
|
||||
// • A MessageDescriptor describes an abstract protobuf message type.
|
||||
// It has no understanding of Go types. In order to construct a MessageType
|
||||
// from just a MessageDescriptor, you can consider looking up the message type
|
||||
// in the global registry using protoregistry.GlobalTypes.FindMessageByName
|
||||
// or constructing a dynamic MessageType using dynamicpb.NewMessageType.
|
||||
// • A [MessageDescriptor] describes an abstract protobuf message type.
|
||||
// It has no understanding of Go types. In order to construct a [MessageType]
|
||||
// from just a [MessageDescriptor], you can consider looking up the message type
|
||||
// in the global registry using the FindMessageByName method on
|
||||
// [google.golang.org/protobuf/reflect/protoregistry.GlobalTypes]
|
||||
// or constructing a dynamic [MessageType] using
|
||||
// [google.golang.org/protobuf/types/dynamicpb.NewMessageType].
|
||||
//
|
||||
// • A Message is a reflective view over a concrete message instance.
|
||||
// Generated messages implement ProtoMessage, which can convert to a Message.
|
||||
// Just as how Go's reflect.Value is a reflective view over a Go value,
|
||||
// a Message is a reflective view over a concrete protobuf message instance.
|
||||
// Using Go reflection as an analogy, the ProtoReflect method is similar to
|
||||
// calling reflect.ValueOf, and the Message.Interface method is similar to
|
||||
// calling reflect.Value.Interface.
|
||||
// • A [Message] is a reflective view over a concrete message instance.
|
||||
// Generated messages implement [ProtoMessage], which can convert to a [Message].
|
||||
// Just as how Go's [reflect.Value] is a reflective view over a Go value,
|
||||
// a [Message] is a reflective view over a concrete protobuf message instance.
|
||||
// Using Go reflection as an analogy, the [ProtoMessage.ProtoReflect] method is similar to
|
||||
// calling [reflect.ValueOf], and the [Message.Interface] method is similar to
|
||||
// calling [reflect.Value.Interface].
|
||||
//
|
||||
// ┌── TypeDescriptor() ──┐ ┌───── Descriptor() ─────┐
|
||||
// │ V │ V
|
||||
|
|
@ -119,15 +121,15 @@
|
|||
// │ │
|
||||
// └────── implements ────────┘
|
||||
//
|
||||
// • An ExtensionType describes a concrete Go implementation of an extension.
|
||||
// It has an ExtensionTypeDescriptor and can convert to/from
|
||||
// abstract Values and Go values.
|
||||
// • An [ExtensionType] describes a concrete Go implementation of an extension.
|
||||
// It has an [ExtensionTypeDescriptor] and can convert to/from
|
||||
// an abstract [Value] and a Go value.
|
||||
//
|
||||
// • An ExtensionTypeDescriptor is an ExtensionDescriptor
|
||||
// which also has an ExtensionType.
|
||||
// • An [ExtensionTypeDescriptor] is an [ExtensionDescriptor]
|
||||
// which also has an [ExtensionType].
|
||||
//
|
||||
// • An ExtensionDescriptor describes an abstract protobuf extension field and
|
||||
// may not always be an ExtensionTypeDescriptor.
|
||||
// • An [ExtensionDescriptor] describes an abstract protobuf extension field and
|
||||
// may not always be an [ExtensionTypeDescriptor].
|
||||
package protoreflect
|
||||
|
||||
import (
|
||||
|
|
@ -142,7 +144,7 @@ type doNotImplement pragma.DoNotImplement
|
|||
|
||||
// ProtoMessage is the top-level interface that all proto messages implement.
|
||||
// This is declared in the protoreflect package to avoid a cyclic dependency;
|
||||
// use the proto.Message type instead, which aliases this type.
|
||||
// use the [google.golang.org/protobuf/proto.Message] type instead, which aliases this type.
|
||||
type ProtoMessage interface{ ProtoReflect() Message }
|
||||
|
||||
// Syntax is the language version of the proto file.
|
||||
|
|
@ -151,14 +153,15 @@ type Syntax syntax
|
|||
type syntax int8 // keep exact type opaque as the int type may change
|
||||
|
||||
const (
|
||||
Proto2 Syntax = 2
|
||||
Proto3 Syntax = 3
|
||||
Proto2 Syntax = 2
|
||||
Proto3 Syntax = 3
|
||||
Editions Syntax = 4
|
||||
)
|
||||
|
||||
// IsValid reports whether the syntax is valid.
|
||||
func (s Syntax) IsValid() bool {
|
||||
switch s {
|
||||
case Proto2, Proto3:
|
||||
case Proto2, Proto3, Editions:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
|
@ -172,6 +175,8 @@ func (s Syntax) String() string {
|
|||
return "proto2"
|
||||
case Proto3:
|
||||
return "proto3"
|
||||
case Editions:
|
||||
return "editions"
|
||||
default:
|
||||
return fmt.Sprintf("<unknown:%d>", s)
|
||||
}
|
||||
|
|
@ -436,7 +441,7 @@ type Names interface {
|
|||
// FullName is a qualified name that uniquely identifies a proto declaration.
|
||||
// A qualified name is the concatenation of the proto package along with the
|
||||
// fully-declared name (i.e., name of parent preceding the name of the child),
|
||||
// with a '.' delimiter placed between each Name.
|
||||
// with a '.' delimiter placed between each [Name].
|
||||
//
|
||||
// This should not have any leading or trailing dots.
|
||||
type FullName string // e.g., "google.protobuf.Field.Kind"
|
||||
|
|
@ -480,7 +485,7 @@ func isLetterDigit(c byte) bool {
|
|||
}
|
||||
|
||||
// Name returns the short name, which is the last identifier segment.
|
||||
// A single segment FullName is the Name itself.
|
||||
// A single segment FullName is the [Name] itself.
|
||||
func (n FullName) Name() Name {
|
||||
if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
|
||||
return Name(n[i+1:])
|
||||
|
|
|
|||
118
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
generated
vendored
118
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
generated
vendored
|
|
@ -21,6 +21,8 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {
|
|||
b = p.appendRepeatedField(b, "public_dependency", nil)
|
||||
case 11:
|
||||
b = p.appendRepeatedField(b, "weak_dependency", nil)
|
||||
case 15:
|
||||
b = p.appendRepeatedField(b, "option_dependency", nil)
|
||||
case 4:
|
||||
b = p.appendRepeatedField(b, "message_type", (*SourcePath).appendDescriptorProto)
|
||||
case 5:
|
||||
|
|
@ -35,7 +37,7 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo)
|
||||
case 12:
|
||||
b = p.appendSingularField(b, "syntax", nil)
|
||||
case 13:
|
||||
case 14:
|
||||
b = p.appendSingularField(b, "edition", nil)
|
||||
}
|
||||
return b
|
||||
|
|
@ -66,6 +68,8 @@ func (p *SourcePath) appendDescriptorProto(b []byte) []byte {
|
|||
b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendDescriptorProto_ReservedRange)
|
||||
case 10:
|
||||
b = p.appendRepeatedField(b, "reserved_name", nil)
|
||||
case 11:
|
||||
b = p.appendSingularField(b, "visibility", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
@ -85,6 +89,8 @@ func (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte {
|
|||
b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange)
|
||||
case 5:
|
||||
b = p.appendRepeatedField(b, "reserved_name", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "visibility", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
@ -160,8 +166,6 @@ func (p *SourcePath) appendFileOptions(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "java_generic_services", nil)
|
||||
case 18:
|
||||
b = p.appendSingularField(b, "py_generic_services", nil)
|
||||
case 42:
|
||||
b = p.appendSingularField(b, "php_generic_services", nil)
|
||||
case 23:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 31:
|
||||
|
|
@ -180,6 +184,8 @@ func (p *SourcePath) appendFileOptions(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "php_metadata_namespace", nil)
|
||||
case 45:
|
||||
b = p.appendSingularField(b, "ruby_package", nil)
|
||||
case 50:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
|
|
@ -240,6 +246,8 @@ func (p *SourcePath) appendMessageOptions(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "map_entry", nil)
|
||||
case 11:
|
||||
b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
|
||||
case 12:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
|
|
@ -285,6 +293,8 @@ func (p *SourcePath) appendEnumOptions(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
|
|
@ -330,6 +340,8 @@ func (p *SourcePath) appendServiceOptions(b []byte) []byte {
|
|||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 34:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 33:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 999:
|
||||
|
|
@ -361,14 +373,45 @@ func (p *SourcePath) appendFieldOptions(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "debug_redact", nil)
|
||||
case 17:
|
||||
b = p.appendSingularField(b, "retention", nil)
|
||||
case 18:
|
||||
b = p.appendSingularField(b, "target", nil)
|
||||
case 19:
|
||||
b = p.appendRepeatedField(b, "targets", nil)
|
||||
case 20:
|
||||
b = p.appendRepeatedField(b, "edition_defaults", (*SourcePath).appendFieldOptions_EditionDefault)
|
||||
case 21:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 22:
|
||||
b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendFeatureSet(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "field_presence", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "enum_type", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "repeated_field_encoding", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "utf8_validation", nil)
|
||||
case 5:
|
||||
b = p.appendSingularField(b, "message_encoding", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "json_format", nil)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "enforce_naming_style", nil)
|
||||
case 8:
|
||||
b = p.appendSingularField(b, "default_symbol_visibility", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendUninterpretedOption(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
|
|
@ -418,6 +461,12 @@ func (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte {
|
|||
switch (*p)[0] {
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
case 2:
|
||||
b = p.appendRepeatedField(b, "declaration", (*SourcePath).appendExtensionRangeOptions_Declaration)
|
||||
case 50:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "verification", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
@ -427,6 +476,8 @@ func (p *SourcePath) appendOneofOptions(b []byte) []byte {
|
|||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
|
|
@ -440,6 +491,12 @@ func (p *SourcePath) appendEnumValueOptions(b []byte) []byte {
|
|||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "debug_redact", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "feature_support", (*SourcePath).appendFieldOptions_FeatureSupport)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
|
|
@ -455,12 +512,44 @@ func (p *SourcePath) appendMethodOptions(b []byte) []byte {
|
|||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 34:
|
||||
b = p.appendSingularField(b, "idempotency_level", nil)
|
||||
case 35:
|
||||
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendFieldOptions_EditionDefault(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "edition", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "value", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendFieldOptions_FeatureSupport(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "edition_introduced", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "edition_deprecated", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "deprecation_warning", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "edition_removed", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
|
|
@ -473,3 +562,22 @@ func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {
|
|||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendExtensionRangeOptions_Declaration(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "number", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "full_name", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "type", nil)
|
||||
case 5:
|
||||
b = p.appendSingularField(b, "reserved", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "repeated", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
|||
68
vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
generated
vendored
68
vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
generated
vendored
|
|
@ -12,7 +12,7 @@ package protoreflect
|
|||
// exactly identical. However, it is possible for the same semantically
|
||||
// identical proto type to be represented by multiple type descriptors.
|
||||
//
|
||||
// For example, suppose we have t1 and t2 which are both MessageDescriptors.
|
||||
// For example, suppose we have t1 and t2 which are both an [MessageDescriptor].
|
||||
// If t1 == t2, then the types are definitely equal and all accessors return
|
||||
// the same information. However, if t1 != t2, then it is still possible that
|
||||
// they still represent the same proto type (e.g., t1.FullName == t2.FullName).
|
||||
|
|
@ -68,7 +68,7 @@ type Descriptor interface {
|
|||
// dependency is not resolved, in which case only name information is known.
|
||||
//
|
||||
// Placeholder types may only be returned by the following accessors
|
||||
// as a result of unresolved dependencies or weak imports:
|
||||
// as a result of unresolved dependencies:
|
||||
//
|
||||
// ╔═══════════════════════════════════╤═════════════════════╗
|
||||
// ║ Accessor │ Descriptor ║
|
||||
|
|
@ -115,7 +115,7 @@ type Descriptor interface {
|
|||
// corresponds with the google.protobuf.FileDescriptorProto message.
|
||||
//
|
||||
// Top-level declarations:
|
||||
// EnumDescriptor, MessageDescriptor, FieldDescriptor, and/or ServiceDescriptor.
|
||||
// [EnumDescriptor], [MessageDescriptor], [FieldDescriptor], and/or [ServiceDescriptor].
|
||||
type FileDescriptor interface {
|
||||
Descriptor // Descriptor.FullName is identical to Package
|
||||
|
||||
|
|
@ -168,11 +168,7 @@ type FileImport struct {
|
|||
// The current file and the imported file must be within proto package.
|
||||
IsPublic bool
|
||||
|
||||
// IsWeak reports whether this is a weak import, which does not impose
|
||||
// a direct dependency on the target file.
|
||||
//
|
||||
// Weak imports are a legacy proto1 feature. Equivalent behavior is
|
||||
// achieved using proto2 extension fields or proto3 Any messages.
|
||||
// Deprecated: support for weak fields has been removed.
|
||||
IsWeak bool
|
||||
}
|
||||
|
||||
|
|
@ -180,8 +176,8 @@ type FileImport struct {
|
|||
// corresponds with the google.protobuf.DescriptorProto message.
|
||||
//
|
||||
// Nested declarations:
|
||||
// FieldDescriptor, OneofDescriptor, FieldDescriptor, EnumDescriptor,
|
||||
// and/or MessageDescriptor.
|
||||
// [FieldDescriptor], [OneofDescriptor], [FieldDescriptor], [EnumDescriptor],
|
||||
// and/or [MessageDescriptor].
|
||||
type MessageDescriptor interface {
|
||||
Descriptor
|
||||
|
||||
|
|
@ -214,7 +210,7 @@ type MessageDescriptor interface {
|
|||
ExtensionRanges() FieldRanges
|
||||
// ExtensionRangeOptions returns the ith extension range options.
|
||||
//
|
||||
// To avoid a dependency cycle, this method returns a proto.Message value,
|
||||
// To avoid a dependency cycle, this method returns a proto.Message] value,
|
||||
// which always contains a google.protobuf.ExtensionRangeOptions message.
|
||||
// This method returns a typed nil-pointer if no options are present.
|
||||
// The caller must import the descriptorpb package to use this.
|
||||
|
|
@ -231,9 +227,9 @@ type MessageDescriptor interface {
|
|||
}
|
||||
type isMessageDescriptor interface{ ProtoType(MessageDescriptor) }
|
||||
|
||||
// MessageType encapsulates a MessageDescriptor with a concrete Go implementation.
|
||||
// MessageType encapsulates a [MessageDescriptor] with a concrete Go implementation.
|
||||
// It is recommended that implementations of this interface also implement the
|
||||
// MessageFieldTypes interface.
|
||||
// [MessageFieldTypes] interface.
|
||||
type MessageType interface {
|
||||
// New returns a newly allocated empty message.
|
||||
// It may return nil for synthetic messages representing a map entry.
|
||||
|
|
@ -249,19 +245,19 @@ type MessageType interface {
|
|||
Descriptor() MessageDescriptor
|
||||
}
|
||||
|
||||
// MessageFieldTypes extends a MessageType by providing type information
|
||||
// MessageFieldTypes extends a [MessageType] by providing type information
|
||||
// regarding enums and messages referenced by the message fields.
|
||||
type MessageFieldTypes interface {
|
||||
MessageType
|
||||
|
||||
// Enum returns the EnumType for the ith field in Descriptor.Fields.
|
||||
// Enum returns the EnumType for the ith field in MessageDescriptor.Fields.
|
||||
// It returns nil if the ith field is not an enum kind.
|
||||
// It panics if out of bounds.
|
||||
//
|
||||
// Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum()
|
||||
Enum(i int) EnumType
|
||||
|
||||
// Message returns the MessageType for the ith field in Descriptor.Fields.
|
||||
// Message returns the MessageType for the ith field in MessageDescriptor.Fields.
|
||||
// It returns nil if the ith field is not a message or group kind.
|
||||
// It panics if out of bounds.
|
||||
//
|
||||
|
|
@ -286,8 +282,8 @@ type MessageDescriptors interface {
|
|||
// corresponds with the google.protobuf.FieldDescriptorProto message.
|
||||
//
|
||||
// It is used for both normal fields defined within the parent message
|
||||
// (e.g., MessageDescriptor.Fields) and fields that extend some remote message
|
||||
// (e.g., FileDescriptor.Extensions or MessageDescriptor.Extensions).
|
||||
// (e.g., [MessageDescriptor.Fields]) and fields that extend some remote message
|
||||
// (e.g., [FileDescriptor.Extensions] or [MessageDescriptor.Extensions]).
|
||||
type FieldDescriptor interface {
|
||||
Descriptor
|
||||
|
||||
|
|
@ -325,9 +321,7 @@ type FieldDescriptor interface {
|
|||
// specified in the source .proto file.
|
||||
HasOptionalKeyword() bool
|
||||
|
||||
// IsWeak reports whether this is a weak field, which does not impose a
|
||||
// direct dependency on the target type.
|
||||
// If true, then Message returns a placeholder type.
|
||||
// Deprecated: support for weak fields has been removed.
|
||||
IsWeak() bool
|
||||
|
||||
// IsPacked reports whether repeated primitive numeric kinds should be
|
||||
|
|
@ -344,7 +338,7 @@ type FieldDescriptor interface {
|
|||
// IsMap reports whether this field represents a map,
|
||||
// where the value type for the associated field is a Map.
|
||||
// It is equivalent to checking whether Cardinality is Repeated,
|
||||
// that the Kind is MessageKind, and that Message.IsMapEntry reports true.
|
||||
// that the Kind is MessageKind, and that MessageDescriptor.IsMapEntry reports true.
|
||||
IsMap() bool
|
||||
|
||||
// MapKey returns the field descriptor for the key in the map entry.
|
||||
|
|
@ -419,7 +413,7 @@ type OneofDescriptor interface {
|
|||
|
||||
// IsSynthetic reports whether this is a synthetic oneof created to support
|
||||
// proto3 optional semantics. If true, Fields contains exactly one field
|
||||
// with HasOptionalKeyword specified.
|
||||
// with FieldDescriptor.HasOptionalKeyword specified.
|
||||
IsSynthetic() bool
|
||||
|
||||
// Fields is a list of fields belonging to this oneof.
|
||||
|
|
@ -442,10 +436,10 @@ type OneofDescriptors interface {
|
|||
doNotImplement
|
||||
}
|
||||
|
||||
// ExtensionDescriptor is an alias of FieldDescriptor for documentation.
|
||||
// ExtensionDescriptor is an alias of [FieldDescriptor] for documentation.
|
||||
type ExtensionDescriptor = FieldDescriptor
|
||||
|
||||
// ExtensionTypeDescriptor is an ExtensionDescriptor with an associated ExtensionType.
|
||||
// ExtensionTypeDescriptor is an [ExtensionDescriptor] with an associated [ExtensionType].
|
||||
type ExtensionTypeDescriptor interface {
|
||||
ExtensionDescriptor
|
||||
|
||||
|
|
@ -470,12 +464,12 @@ type ExtensionDescriptors interface {
|
|||
doNotImplement
|
||||
}
|
||||
|
||||
// ExtensionType encapsulates an ExtensionDescriptor with a concrete
|
||||
// ExtensionType encapsulates an [ExtensionDescriptor] with a concrete
|
||||
// Go implementation. The nested field descriptor must be for a extension field.
|
||||
//
|
||||
// While a normal field is a member of the parent message that it is declared
|
||||
// within (see Descriptor.Parent), an extension field is a member of some other
|
||||
// target message (see ExtensionDescriptor.Extendee) and may have no
|
||||
// within (see [Descriptor.Parent]), an extension field is a member of some other
|
||||
// target message (see [FieldDescriptor.ContainingMessage]) and may have no
|
||||
// relationship with the parent. However, the full name of an extension field is
|
||||
// relative to the parent that it is declared within.
|
||||
//
|
||||
|
|
@ -510,7 +504,7 @@ type ExtensionType interface {
|
|||
//
|
||||
// ValueOf is more extensive than protoreflect.ValueOf for a given field's
|
||||
// value as it has more type information available.
|
||||
ValueOf(interface{}) Value
|
||||
ValueOf(any) Value
|
||||
|
||||
// InterfaceOf completely unwraps the Value to the underlying Go type.
|
||||
// InterfaceOf panics if the input is nil or does not represent the
|
||||
|
|
@ -519,20 +513,20 @@ type ExtensionType interface {
|
|||
//
|
||||
// InterfaceOf is able to unwrap the Value further than Value.Interface
|
||||
// as it has more type information available.
|
||||
InterfaceOf(Value) interface{}
|
||||
InterfaceOf(Value) any
|
||||
|
||||
// IsValidValue reports whether the Value is valid to assign to the field.
|
||||
IsValidValue(Value) bool
|
||||
|
||||
// IsValidInterface reports whether the input is valid to assign to the field.
|
||||
IsValidInterface(interface{}) bool
|
||||
IsValidInterface(any) bool
|
||||
}
|
||||
|
||||
// EnumDescriptor describes an enum and
|
||||
// corresponds with the google.protobuf.EnumDescriptorProto message.
|
||||
//
|
||||
// Nested declarations:
|
||||
// EnumValueDescriptor.
|
||||
// [EnumValueDescriptor].
|
||||
type EnumDescriptor interface {
|
||||
Descriptor
|
||||
|
||||
|
|
@ -544,11 +538,17 @@ type EnumDescriptor interface {
|
|||
// ReservedRanges is a list of reserved ranges of enum numbers.
|
||||
ReservedRanges() EnumRanges
|
||||
|
||||
// IsClosed reports whether this enum uses closed semantics.
|
||||
// See https://protobuf.dev/programming-guides/enum/#definitions.
|
||||
// Note: the Go protobuf implementation is not spec compliant and treats
|
||||
// all enums as open enums.
|
||||
IsClosed() bool
|
||||
|
||||
isEnumDescriptor
|
||||
}
|
||||
type isEnumDescriptor interface{ ProtoType(EnumDescriptor) }
|
||||
|
||||
// EnumType encapsulates an EnumDescriptor with a concrete Go implementation.
|
||||
// EnumType encapsulates an [EnumDescriptor] with a concrete Go implementation.
|
||||
type EnumType interface {
|
||||
// New returns an instance of this enum type with its value set to n.
|
||||
New(n EnumNumber) Enum
|
||||
|
|
@ -610,7 +610,7 @@ type EnumValueDescriptors interface {
|
|||
// ServiceDescriptor describes a service and
|
||||
// corresponds with the google.protobuf.ServiceDescriptorProto message.
|
||||
//
|
||||
// Nested declarations: MethodDescriptor.
|
||||
// Nested declarations: [MethodDescriptor].
|
||||
type ServiceDescriptor interface {
|
||||
Descriptor
|
||||
|
||||
|
|
|
|||
24
vendor/google.golang.org/protobuf/reflect/protoreflect/value.go
generated
vendored
24
vendor/google.golang.org/protobuf/reflect/protoreflect/value.go
generated
vendored
|
|
@ -27,16 +27,16 @@ type Enum interface {
|
|||
// Message is a reflective interface for a concrete message value,
|
||||
// encapsulating both type and value information for the message.
|
||||
//
|
||||
// Accessor/mutators for individual fields are keyed by FieldDescriptor.
|
||||
// Accessor/mutators for individual fields are keyed by [FieldDescriptor].
|
||||
// For non-extension fields, the descriptor must exactly match the
|
||||
// field known by the parent message.
|
||||
// For extension fields, the descriptor must implement ExtensionTypeDescriptor,
|
||||
// extend the parent message (i.e., have the same message FullName), and
|
||||
// For extension fields, the descriptor must implement [ExtensionTypeDescriptor],
|
||||
// extend the parent message (i.e., have the same message [FullName]), and
|
||||
// be within the parent's extension range.
|
||||
//
|
||||
// Each field Value can be a scalar or a composite type (Message, List, or Map).
|
||||
// See Value for the Go types associated with a FieldDescriptor.
|
||||
// Providing a Value that is invalid or of an incorrect type panics.
|
||||
// Each field [Value] can be a scalar or a composite type ([Message], [List], or [Map]).
|
||||
// See [Value] for the Go types associated with a [FieldDescriptor].
|
||||
// Providing a [Value] that is invalid or of an incorrect type panics.
|
||||
type Message interface {
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
|
|
@ -152,7 +152,7 @@ type Message interface {
|
|||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// [google.golang.org/protobuf/runtime/protoiface.Methods].
|
||||
// Consult the protoiface package documentation for details.
|
||||
ProtoMethods() *methods
|
||||
}
|
||||
|
|
@ -175,8 +175,8 @@ func (b RawFields) IsValid() bool {
|
|||
}
|
||||
|
||||
// List is a zero-indexed, ordered list.
|
||||
// The element Value type is determined by FieldDescriptor.Kind.
|
||||
// Providing a Value that is invalid or of an incorrect type panics.
|
||||
// The element [Value] type is determined by [FieldDescriptor.Kind].
|
||||
// Providing a [Value] that is invalid or of an incorrect type panics.
|
||||
type List interface {
|
||||
// Len reports the number of entries in the List.
|
||||
// Get, Set, and Truncate panic with out of bound indexes.
|
||||
|
|
@ -226,9 +226,9 @@ type List interface {
|
|||
}
|
||||
|
||||
// Map is an unordered, associative map.
|
||||
// The entry MapKey type is determined by FieldDescriptor.MapKey.Kind.
|
||||
// The entry Value type is determined by FieldDescriptor.MapValue.Kind.
|
||||
// Providing a MapKey or Value that is invalid or of an incorrect type panics.
|
||||
// The entry [MapKey] type is determined by [FieldDescriptor.MapKey].Kind.
|
||||
// The entry [Value] type is determined by [FieldDescriptor.MapValue].Kind.
|
||||
// Providing a [MapKey] or [Value] that is invalid or of an incorrect type panics.
|
||||
type Map interface {
|
||||
// Len reports the number of elements in the map.
|
||||
Len() int
|
||||
|
|
|
|||
8
vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go
generated
vendored
8
vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go
generated
vendored
|
|
@ -24,19 +24,19 @@ import (
|
|||
// Unlike the == operator, a NaN is equal to another NaN.
|
||||
//
|
||||
// - Enums are equal if they contain the same number.
|
||||
// Since Value does not contain an enum descriptor,
|
||||
// Since [Value] does not contain an enum descriptor,
|
||||
// enum values do not consider the type of the enum.
|
||||
//
|
||||
// - Other scalar values are equal if they contain the same value.
|
||||
//
|
||||
// - Message values are equal if they belong to the same message descriptor,
|
||||
// - [Message] values are equal if they belong to the same message descriptor,
|
||||
// have the same set of populated known and extension field values,
|
||||
// and the same set of unknown fields values.
|
||||
//
|
||||
// - Lists are equal if they are the same length and
|
||||
// - [List] values are equal if they are the same length and
|
||||
// each corresponding element is equal.
|
||||
//
|
||||
// - Maps are equal if they have the same set of keys and
|
||||
// - [Map] values are equal if they have the same set of keys and
|
||||
// the corresponding value for each key is equal.
|
||||
func (v1 Value) Equal(v2 Value) bool {
|
||||
return equalValue(v1, v2)
|
||||
|
|
|
|||
60
vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
generated
vendored
60
vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
generated
vendored
|
|
@ -1,60 +0,0 @@
|
|||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build purego || appengine
|
||||
// +build purego appengine
|
||||
|
||||
package protoreflect
|
||||
|
||||
import "google.golang.org/protobuf/internal/pragma"
|
||||
|
||||
type valueType int
|
||||
|
||||
const (
|
||||
nilType valueType = iota
|
||||
boolType
|
||||
int32Type
|
||||
int64Type
|
||||
uint32Type
|
||||
uint64Type
|
||||
float32Type
|
||||
float64Type
|
||||
stringType
|
||||
bytesType
|
||||
enumType
|
||||
ifaceType
|
||||
)
|
||||
|
||||
// value is a union where only one type can be represented at a time.
|
||||
// This uses a distinct field for each type. This is type safe in Go, but
|
||||
// occupies more memory than necessary (72B).
|
||||
type value struct {
|
||||
pragma.DoNotCompare // 0B
|
||||
|
||||
typ valueType // 8B
|
||||
num uint64 // 8B
|
||||
str string // 16B
|
||||
bin []byte // 24B
|
||||
iface interface{} // 16B
|
||||
}
|
||||
|
||||
func valueOfString(v string) Value {
|
||||
return Value{typ: stringType, str: v}
|
||||
}
|
||||
func valueOfBytes(v []byte) Value {
|
||||
return Value{typ: bytesType, bin: v}
|
||||
}
|
||||
func valueOfIface(v interface{}) Value {
|
||||
return Value{typ: ifaceType, iface: v}
|
||||
}
|
||||
|
||||
func (v Value) getString() string {
|
||||
return v.str
|
||||
}
|
||||
func (v Value) getBytes() []byte {
|
||||
return v.bin
|
||||
}
|
||||
func (v Value) getIface() interface{} {
|
||||
return v.iface
|
||||
}
|
||||
58
vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
generated
vendored
58
vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
generated
vendored
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
// Value is a union where only one Go type may be set at a time.
|
||||
// The Value is used to represent all possible values a field may take.
|
||||
// The following shows which Go type is used to represent each proto Kind:
|
||||
// The following shows which Go type is used to represent each proto [Kind]:
|
||||
//
|
||||
// ╔════════════╤═════════════════════════════════════╗
|
||||
// ║ Go type │ Protobuf kind ║
|
||||
|
|
@ -31,22 +31,22 @@ import (
|
|||
//
|
||||
// Multiple protobuf Kinds may be represented by a single Go type if the type
|
||||
// can losslessly represent the information for the proto kind. For example,
|
||||
// Int64Kind, Sint64Kind, and Sfixed64Kind are all represented by int64,
|
||||
// [Int64Kind], [Sint64Kind], and [Sfixed64Kind] are all represented by int64,
|
||||
// but use different integer encoding methods.
|
||||
//
|
||||
// The List or Map types are used if the field cardinality is repeated.
|
||||
// A field is a List if FieldDescriptor.IsList reports true.
|
||||
// A field is a Map if FieldDescriptor.IsMap reports true.
|
||||
// The [List] or [Map] types are used if the field cardinality is repeated.
|
||||
// A field is a [List] if [FieldDescriptor.IsList] reports true.
|
||||
// A field is a [Map] if [FieldDescriptor.IsMap] reports true.
|
||||
//
|
||||
// Converting to/from a Value and a concrete Go value panics on type mismatch.
|
||||
// For example, ValueOf("hello").Int() panics because this attempts to
|
||||
// For example, [ValueOf]("hello").Int() panics because this attempts to
|
||||
// retrieve an int64 from a string.
|
||||
//
|
||||
// List, Map, and Message Values are called "composite" values.
|
||||
// [List], [Map], and [Message] Values are called "composite" values.
|
||||
//
|
||||
// A composite Value may alias (reference) memory at some location,
|
||||
// such that changes to the Value updates the that location.
|
||||
// A composite value acquired with a Mutable method, such as Message.Mutable,
|
||||
// A composite value acquired with a Mutable method, such as [Message.Mutable],
|
||||
// always references the source object.
|
||||
//
|
||||
// For example:
|
||||
|
|
@ -65,12 +65,12 @@ import (
|
|||
// // appending to the List here may or may not modify the message.
|
||||
// list.Append(protoreflect.ValueOfInt32(0))
|
||||
//
|
||||
// Some operations, such as Message.Get, may return an "empty, read-only"
|
||||
// Some operations, such as [Message.Get], may return an "empty, read-only"
|
||||
// composite Value. Modifying an empty, read-only value panics.
|
||||
type Value value
|
||||
|
||||
// The protoreflect API uses a custom Value union type instead of interface{}
|
||||
// to keep the future open for performance optimizations. Using an interface{}
|
||||
// The protoreflect API uses a custom Value union type instead of any
|
||||
// to keep the future open for performance optimizations. Using an any
|
||||
// always incurs an allocation for primitives (e.g., int64) since it needs to
|
||||
// be boxed on the heap (as interfaces can only contain pointers natively).
|
||||
// Instead, we represent the Value union as a flat struct that internally keeps
|
||||
|
|
@ -85,7 +85,7 @@ type Value value
|
|||
// ValueOf returns a Value initialized with the concrete value stored in v.
|
||||
// This panics if the type does not match one of the allowed types in the
|
||||
// Value union.
|
||||
func ValueOf(v interface{}) Value {
|
||||
func ValueOf(v any) Value {
|
||||
switch v := v.(type) {
|
||||
case nil:
|
||||
return Value{}
|
||||
|
|
@ -192,10 +192,10 @@ func (v Value) IsValid() bool {
|
|||
return v.typ != nilType
|
||||
}
|
||||
|
||||
// Interface returns v as an interface{}.
|
||||
// Interface returns v as an any.
|
||||
//
|
||||
// Invariant: v == ValueOf(v).Interface()
|
||||
func (v Value) Interface() interface{} {
|
||||
func (v Value) Interface() any {
|
||||
switch v.typ {
|
||||
case nilType:
|
||||
return nil
|
||||
|
|
@ -306,7 +306,7 @@ func (v Value) Float() float64 {
|
|||
}
|
||||
}
|
||||
|
||||
// String returns v as a string. Since this method implements fmt.Stringer,
|
||||
// String returns v as a string. Since this method implements [fmt.Stringer],
|
||||
// this returns the formatted string value for any non-string type.
|
||||
func (v Value) String() string {
|
||||
switch v.typ {
|
||||
|
|
@ -327,7 +327,7 @@ func (v Value) Bytes() []byte {
|
|||
}
|
||||
}
|
||||
|
||||
// Enum returns v as a EnumNumber and panics if the type is not a EnumNumber.
|
||||
// Enum returns v as a [EnumNumber] and panics if the type is not a [EnumNumber].
|
||||
func (v Value) Enum() EnumNumber {
|
||||
switch v.typ {
|
||||
case enumType:
|
||||
|
|
@ -337,7 +337,7 @@ func (v Value) Enum() EnumNumber {
|
|||
}
|
||||
}
|
||||
|
||||
// Message returns v as a Message and panics if the type is not a Message.
|
||||
// Message returns v as a [Message] and panics if the type is not a [Message].
|
||||
func (v Value) Message() Message {
|
||||
switch vi := v.getIface().(type) {
|
||||
case Message:
|
||||
|
|
@ -347,7 +347,7 @@ func (v Value) Message() Message {
|
|||
}
|
||||
}
|
||||
|
||||
// List returns v as a List and panics if the type is not a List.
|
||||
// List returns v as a [List] and panics if the type is not a [List].
|
||||
func (v Value) List() List {
|
||||
switch vi := v.getIface().(type) {
|
||||
case List:
|
||||
|
|
@ -357,7 +357,7 @@ func (v Value) List() List {
|
|||
}
|
||||
}
|
||||
|
||||
// Map returns v as a Map and panics if the type is not a Map.
|
||||
// Map returns v as a [Map] and panics if the type is not a [Map].
|
||||
func (v Value) Map() Map {
|
||||
switch vi := v.getIface().(type) {
|
||||
case Map:
|
||||
|
|
@ -367,7 +367,7 @@ func (v Value) Map() Map {
|
|||
}
|
||||
}
|
||||
|
||||
// MapKey returns v as a MapKey and panics for invalid MapKey types.
|
||||
// MapKey returns v as a [MapKey] and panics for invalid [MapKey] types.
|
||||
func (v Value) MapKey() MapKey {
|
||||
switch v.typ {
|
||||
case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:
|
||||
|
|
@ -378,8 +378,8 @@ func (v Value) MapKey() MapKey {
|
|||
}
|
||||
|
||||
// MapKey is used to index maps, where the Go type of the MapKey must match
|
||||
// the specified key Kind (see MessageDescriptor.IsMapEntry).
|
||||
// The following shows what Go type is used to represent each proto Kind:
|
||||
// the specified key [Kind] (see [MessageDescriptor.IsMapEntry]).
|
||||
// The following shows what Go type is used to represent each proto [Kind]:
|
||||
//
|
||||
// ╔═════════╤═════════════════════════════════════╗
|
||||
// ║ Go type │ Protobuf kind ║
|
||||
|
|
@ -392,13 +392,13 @@ func (v Value) MapKey() MapKey {
|
|||
// ║ string │ StringKind ║
|
||||
// ╚═════════╧═════════════════════════════════════╝
|
||||
//
|
||||
// A MapKey is constructed and accessed through a Value:
|
||||
// A MapKey is constructed and accessed through a [Value]:
|
||||
//
|
||||
// k := ValueOf("hash").MapKey() // convert string to MapKey
|
||||
// s := k.String() // convert MapKey to string
|
||||
//
|
||||
// The MapKey is a strict subset of valid types used in Value;
|
||||
// converting a Value to a MapKey with an invalid type panics.
|
||||
// The MapKey is a strict subset of valid types used in [Value];
|
||||
// converting a [Value] to a MapKey with an invalid type panics.
|
||||
type MapKey value
|
||||
|
||||
// IsValid reports whether k is populated with a value.
|
||||
|
|
@ -406,8 +406,8 @@ func (k MapKey) IsValid() bool {
|
|||
return Value(k).IsValid()
|
||||
}
|
||||
|
||||
// Interface returns k as an interface{}.
|
||||
func (k MapKey) Interface() interface{} {
|
||||
// Interface returns k as an any.
|
||||
func (k MapKey) Interface() any {
|
||||
return Value(k).Interface()
|
||||
}
|
||||
|
||||
|
|
@ -426,13 +426,13 @@ func (k MapKey) Uint() uint64 {
|
|||
return Value(k).Uint()
|
||||
}
|
||||
|
||||
// String returns k as a string. Since this method implements fmt.Stringer,
|
||||
// String returns k as a string. Since this method implements [fmt.Stringer],
|
||||
// this returns the formatted string value for any non-string type.
|
||||
func (k MapKey) String() string {
|
||||
return Value(k).String()
|
||||
}
|
||||
|
||||
// Value returns k as a Value.
|
||||
// Value returns k as a [Value].
|
||||
func (k MapKey) Value() Value {
|
||||
return Value(k)
|
||||
}
|
||||
|
|
|
|||
35
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go
generated
vendored
35
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go
generated
vendored
|
|
@ -2,9 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !purego && !appengine
|
||||
// +build !purego,!appengine
|
||||
|
||||
package protoreflect
|
||||
|
||||
import (
|
||||
|
|
@ -14,16 +11,8 @@ import (
|
|||
)
|
||||
|
||||
type (
|
||||
stringHeader struct {
|
||||
Data unsafe.Pointer
|
||||
Len int
|
||||
}
|
||||
sliceHeader struct {
|
||||
Data unsafe.Pointer
|
||||
Len int
|
||||
Cap int
|
||||
}
|
||||
ifaceHeader struct {
|
||||
_ [0]any // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
|
||||
Type unsafe.Pointer
|
||||
Data unsafe.Pointer
|
||||
}
|
||||
|
|
@ -45,7 +34,7 @@ var (
|
|||
|
||||
// typeOf returns a pointer to the Go type information.
|
||||
// The pointer is comparable and equal if and only if the types are identical.
|
||||
func typeOf(t interface{}) unsafe.Pointer {
|
||||
func typeOf(t any) unsafe.Pointer {
|
||||
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
|
||||
}
|
||||
|
||||
|
|
@ -73,27 +62,23 @@ type value struct {
|
|||
}
|
||||
|
||||
func valueOfString(v string) Value {
|
||||
p := (*stringHeader)(unsafe.Pointer(&v))
|
||||
return Value{typ: stringType, ptr: p.Data, num: uint64(len(v))}
|
||||
return Value{typ: stringType, ptr: unsafe.Pointer(unsafe.StringData(v)), num: uint64(len(v))}
|
||||
}
|
||||
func valueOfBytes(v []byte) Value {
|
||||
p := (*sliceHeader)(unsafe.Pointer(&v))
|
||||
return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}
|
||||
return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))}
|
||||
}
|
||||
func valueOfIface(v interface{}) Value {
|
||||
func valueOfIface(v any) Value {
|
||||
p := (*ifaceHeader)(unsafe.Pointer(&v))
|
||||
return Value{typ: p.Type, ptr: p.Data}
|
||||
}
|
||||
|
||||
func (v Value) getString() (x string) {
|
||||
*(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)}
|
||||
return x
|
||||
func (v Value) getString() string {
|
||||
return unsafe.String((*byte)(v.ptr), v.num)
|
||||
}
|
||||
func (v Value) getBytes() (x []byte) {
|
||||
*(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}
|
||||
return x
|
||||
func (v Value) getBytes() []byte {
|
||||
return unsafe.Slice((*byte)(v.ptr), v.num)
|
||||
}
|
||||
func (v Value) getIface() (x interface{}) {
|
||||
func (v Value) getIface() (x any) {
|
||||
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
|
||||
return x
|
||||
}
|
||||
|
|
|
|||
38
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
38
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
|
|
@ -5,12 +5,12 @@
|
|||
// Package protoregistry provides data structures to register and lookup
|
||||
// protobuf descriptor types.
|
||||
//
|
||||
// The Files registry contains file descriptors and provides the ability
|
||||
// The [Files] registry contains file descriptors and provides the ability
|
||||
// to iterate over the files or lookup a specific descriptor within the files.
|
||||
// Files only contains protobuf descriptors and has no understanding of Go
|
||||
// [Files] only contains protobuf descriptors and has no understanding of Go
|
||||
// type information that may be associated with each descriptor.
|
||||
//
|
||||
// The Types registry contains descriptor types for which there is a known
|
||||
// The [Types] registry contains descriptor types for which there is a known
|
||||
// Go type associated with that descriptor. It provides the ability to iterate
|
||||
// over the registered types or lookup a type by name.
|
||||
package protoregistry
|
||||
|
|
@ -95,7 +95,7 @@ type Files struct {
|
|||
// multiple files. Only top-level declarations are registered.
|
||||
// Note that enum values are in the top-level since that are in the same
|
||||
// scope as the parent enum.
|
||||
descsByName map[protoreflect.FullName]interface{}
|
||||
descsByName map[protoreflect.FullName]any
|
||||
filesByPath map[string][]protoreflect.FileDescriptor
|
||||
numFiles int
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
|||
defer globalMutex.Unlock()
|
||||
}
|
||||
if r.descsByName == nil {
|
||||
r.descsByName = map[protoreflect.FullName]interface{}{
|
||||
r.descsByName = map[protoreflect.FullName]any{
|
||||
"": &packageDescriptor{},
|
||||
}
|
||||
r.filesByPath = make(map[string][]protoreflect.FileDescriptor)
|
||||
|
|
@ -218,7 +218,7 @@ func (r *Files) checkGenProtoConflict(path string) {
|
|||
|
||||
// FindDescriptorByName looks up a descriptor by the full name.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
func (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
|
|
@ -310,7 +310,7 @@ func (s *nameSuffix) Pop() (name protoreflect.Name) {
|
|||
|
||||
// FindFileByPath looks up a file by the path.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
// This returns an error if multiple files have the same path.
|
||||
func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
|
||||
if r == nil {
|
||||
|
|
@ -431,7 +431,7 @@ func rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflec
|
|||
// A compliant implementation must deterministically return the same type
|
||||
// if no error is encountered.
|
||||
//
|
||||
// The Types type implements this interface.
|
||||
// The [Types] type implements this interface.
|
||||
type MessageTypeResolver interface {
|
||||
// FindMessageByName looks up a message by its full name.
|
||||
// E.g., "google.protobuf.Any"
|
||||
|
|
@ -451,7 +451,7 @@ type MessageTypeResolver interface {
|
|||
// A compliant implementation must deterministically return the same type
|
||||
// if no error is encountered.
|
||||
//
|
||||
// The Types type implements this interface.
|
||||
// The [Types] type implements this interface.
|
||||
type ExtensionTypeResolver interface {
|
||||
// FindExtensionByName looks up a extension field by the field's full name.
|
||||
// Note that this is the full name of the field as determined by
|
||||
|
|
@ -485,7 +485,7 @@ type Types struct {
|
|||
}
|
||||
|
||||
type (
|
||||
typesByName map[protoreflect.FullName]interface{}
|
||||
typesByName map[protoreflect.FullName]any
|
||||
extensionsByMessage map[protoreflect.FullName]extensionsByNumber
|
||||
extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType
|
||||
)
|
||||
|
|
@ -570,7 +570,7 @@ func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error {
|
||||
func (r *Types) register(kind string, desc protoreflect.Descriptor, typ any) error {
|
||||
name := desc.FullName()
|
||||
prev := r.typesByName[name]
|
||||
if prev != nil {
|
||||
|
|
@ -590,7 +590,7 @@ func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interfac
|
|||
// FindEnumByName looks up an enum by its full name.
|
||||
// E.g., "google.protobuf.Field.Kind".
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) {
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
|
|
@ -611,7 +611,7 @@ func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumTyp
|
|||
// FindMessageByName looks up a message by its full name,
|
||||
// e.g. "google.protobuf.Any".
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
|
|
@ -632,7 +632,7 @@ func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.M
|
|||
// FindMessageByURL looks up a message by a URL identifier.
|
||||
// See documentation on google.protobuf.Any.type_url for the URL format.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
||||
// This function is similar to FindMessageByName but
|
||||
// truncates anything before and including '/' in the URL.
|
||||
|
|
@ -662,7 +662,7 @@ func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
|||
// where the extension is declared and is unrelated to the full name of the
|
||||
// message being extended.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
|
|
@ -703,7 +703,7 @@ func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.E
|
|||
// FindExtensionByNumber looks up a extension field by the field number
|
||||
// within some parent message, identified by full name.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
// This returns (nil, [NotFound]) if not found.
|
||||
func (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
|
|
@ -841,7 +841,7 @@ func (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(p
|
|||
}
|
||||
}
|
||||
|
||||
func typeName(t interface{}) string {
|
||||
func typeName(t any) string {
|
||||
switch t.(type) {
|
||||
case protoreflect.EnumType:
|
||||
return "enum"
|
||||
|
|
@ -854,7 +854,7 @@ func typeName(t interface{}) string {
|
|||
}
|
||||
}
|
||||
|
||||
func amendErrorWithCaller(err error, prev, curr interface{}) error {
|
||||
func amendErrorWithCaller(err error, prev, curr any) error {
|
||||
prevPkg := goPackage(prev)
|
||||
currPkg := goPackage(curr)
|
||||
if prevPkg == "" || currPkg == "" || prevPkg == currPkg {
|
||||
|
|
@ -863,7 +863,7 @@ func amendErrorWithCaller(err error, prev, curr interface{}) error {
|
|||
return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg)
|
||||
}
|
||||
|
||||
func goPackage(v interface{}) string {
|
||||
func goPackage(v any) string {
|
||||
switch d := v.(type) {
|
||||
case protoreflect.EnumType:
|
||||
v = d.Descriptor()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue