diff options
Diffstat (limited to 'vendor/google.golang.org/protobuf')
28 files changed, 385 insertions, 210 deletions
| diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/encode.go b/vendor/google.golang.org/protobuf/encoding/protojson/encode.go index 3f75098b6..29846df22 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/encode.go @@ -25,15 +25,17 @@ const defaultIndent = "  "  // Format formats the message as a multiline string.  // This function is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module.  func Format(m proto.Message) string {  	return MarshalOptions{Multiline: true}.Format(m)  }  // Marshal writes the given [proto.Message] in JSON format using default options. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module.  func Marshal(m proto.Message) ([]byte, error) {  	return MarshalOptions{}.Marshal(m)  } @@ -110,8 +112,9 @@ type MarshalOptions struct {  // Format formats the message as a string.  // This method is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module.  func (o MarshalOptions) Format(m proto.Message) string {  	if m == nil || !m.ProtoReflect().IsValid() {  		return "<nil>" // invalid syntax, but okay since this is for debugging @@ -122,8 +125,9 @@ func (o MarshalOptions) Format(m proto.Message) string {  }  // Marshal marshals the given [proto.Message] in the JSON format using options in -// MarshalOptions. Do not depend on the output being stable. It may change over -// time across different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module.  func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {  	return o.marshal(nil, m)  } diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go index 95967e811..1f57e6610 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go @@ -27,15 +27,17 @@ const defaultIndent = "  "  // Format formats the message as a multiline string.  // This function is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module.  func Format(m proto.Message) string {  	return MarshalOptions{Multiline: true}.Format(m)  }  // Marshal writes the given [proto.Message] in textproto format using default -// options. Do not depend on the output being stable. It may change over time -// across different versions of the program. +// options. Do not depend on the output being stable. Its output will change +// across different builds of your program, even when using the same version of +// the protobuf module.  func Marshal(m proto.Message) ([]byte, error) {  	return MarshalOptions{}.Marshal(m)  } @@ -84,8 +86,9 @@ type MarshalOptions struct {  // Format formats the message as a string.  // This method is only intended for human consumption and ignores errors. -// Do not depend on the output being stable. It may change over time across -// different versions of the program. +// Do not depend on the output being stable. Its output will change across +// different builds of your program, even when using the same version of the +// protobuf module.  func (o MarshalOptions) Format(m proto.Message) string {  	if m == nil || !m.ProtoReflect().IsValid() {  		return "<nil>" // invalid syntax, but okay since this is for debugging @@ -98,8 +101,9 @@ func (o MarshalOptions) Format(m proto.Message) string {  }  // Marshal writes the given [proto.Message] in textproto format using options in -// MarshalOptions object. Do not depend on the output being stable. It may -// change over time across different versions of the program. +// MarshalOptions object. Do not depend on the output being stable. Its output +// will change across different builds of your program, even when using the +// same version of the protobuf module.  func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {  	return o.marshal(nil, m)  } diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go index a45625c8d..87e46bd4d 100644 --- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +++ b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go @@ -252,6 +252,7 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record fu  				{rv.MethodByName("Values"), "Values"},  				{rv.MethodByName("ReservedNames"), "ReservedNames"},  				{rv.MethodByName("ReservedRanges"), "ReservedRanges"}, +				{rv.MethodByName("IsClosed"), "IsClosed"},  			}...)  		case protoreflect.EnumValueDescriptor: diff --git a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpbBinary files differ index 18f075687..f691305eb 100644 --- a/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +++ b/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go index 373d20837..7e87c7604 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go @@ -32,6 +32,7 @@ var byteType = reflect.TypeOf(byte(0))  func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor {  	f := new(filedesc.Field)  	f.L0.ParentFile = filedesc.SurrogateProto2 +	f.L1.EditionFeatures = f.L0.ParentFile.L1.EditionFeatures  	for len(tag) > 0 {  		i := strings.IndexByte(tag, ',')  		if i < 0 { @@ -107,8 +108,7 @@ func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescri  				f.L1.StringName.InitJSON(jsonName)  			}  		case s == "packed": -			f.L1.HasPacked = true -			f.L1.IsPacked = true +			f.L1.EditionFeatures.IsPacked = true  		case strings.HasPrefix(s, "weak="):  			f.L1.IsWeak = true  			f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):])) diff --git a/vendor/google.golang.org/protobuf/internal/errors/errors.go b/vendor/google.golang.org/protobuf/internal/errors/errors.go index 20c17b35e..d96719829 100644 --- a/vendor/google.golang.org/protobuf/internal/errors/errors.go +++ b/vendor/google.golang.org/protobuf/internal/errors/errors.go @@ -87,3 +87,18 @@ func InvalidUTF8(name string) error {  func RequiredNotSet(name string) error {  	return New("required field %v not set", name)  } + +type SizeMismatchError struct { +	Calculated, Measured int +} + +func (e *SizeMismatchError) Error() string { +	return fmt.Sprintf("size mismatch (see https://github.com/golang/protobuf/issues/1609): calculated=%d, measured=%d", e.Calculated, e.Measured) +} + +func MismatchedSizeCalculation(calculated, measured int) error { +	return &SizeMismatchError{ +		Calculated: calculated, +		Measured:   measured, +	} +} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index 8826bcf40..ece53bea3 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -7,6 +7,7 @@ package filedesc  import (  	"bytes"  	"fmt" +	"strings"  	"sync"  	"sync/atomic" @@ -108,9 +109,12 @@ func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }  func (fd *File) Parent() protoreflect.Descriptor         { return nil }  func (fd *File) Index() int                              { return 0 }  func (fd *File) Syntax() protoreflect.Syntax             { return fd.L1.Syntax } -func (fd *File) Name() protoreflect.Name                 { return fd.L1.Package.Name() } -func (fd *File) FullName() protoreflect.FullName         { return fd.L1.Package } -func (fd *File) IsPlaceholder() bool                     { return false } + +// Not exported and just used to reconstruct the original FileDescriptor proto +func (fd *File) Edition() int32                  { return int32(fd.L1.Edition) } +func (fd *File) Name() protoreflect.Name         { return fd.L1.Package.Name() } +func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package } +func (fd *File) IsPlaceholder() bool             { return false }  func (fd *File) Options() protoreflect.ProtoMessage {  	if f := fd.lazyInit().Options; f != nil {  		return f() @@ -202,6 +206,9 @@ func (ed *Enum) lazyInit() *EnumL2 {  	ed.L0.ParentFile.lazyInit() // implicitly initializes L2  	return ed.L2  } +func (ed *Enum) IsClosed() bool { +	return !ed.L1.EditionFeatures.IsOpenEnum +}  func (ed *EnumValue) Options() protoreflect.ProtoMessage {  	if f := ed.L1.Options; f != nil { @@ -251,10 +258,6 @@ type (  		StringName       stringName  		IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto  		IsWeak           bool // promoted from google.protobuf.FieldOptions -		HasPacked        bool // promoted from google.protobuf.FieldOptions -		IsPacked         bool // promoted from google.protobuf.FieldOptions -		HasEnforceUTF8   bool // promoted from google.protobuf.FieldOptions -		EnforceUTF8      bool // promoted from google.protobuf.FieldOptions  		Default          defaultValue  		ContainingOneof  protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields  		Enum             protoreflect.EnumDescriptor @@ -331,8 +334,7 @@ func (fd *Field) HasPresence() bool {  	if fd.L1.Cardinality == protoreflect.Repeated {  		return false  	} -	explicitFieldPresence := fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsFieldPresence -	return fd.Syntax() == protoreflect.Proto2 || explicitFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil +	return fd.IsExtension() || fd.L1.EditionFeatures.IsFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil  }  func (fd *Field) HasOptionalKeyword() bool {  	return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional @@ -345,14 +347,7 @@ func (fd *Field) IsPacked() bool {  	case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:  		return false  	} -	if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions { -		return fd.L1.EditionFeatures.IsPacked -	} -	if fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 { -		// proto3 repeated fields are packed by default. -		return !fd.L1.HasPacked || fd.L1.IsPacked -	} -	return fd.L1.IsPacked +	return fd.L1.EditionFeatures.IsPacked  }  func (fd *Field) IsExtension() bool { return false }  func (fd *Field) IsWeak() bool      { return fd.L1.IsWeak } @@ -399,13 +394,7 @@ func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}  // WARNING: This method is exempt from the compatibility promise and may be  // removed in the future without warning.  func (fd *Field) EnforceUTF8() bool { -	if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions { -		return fd.L1.EditionFeatures.IsUTF8Validated -	} -	if fd.L1.HasEnforceUTF8 { -		return fd.L1.EnforceUTF8 -	} -	return fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 +	return fd.L1.EditionFeatures.IsUTF8Validated  }  func (od *Oneof) IsSynthetic() bool { @@ -438,7 +427,6 @@ type (  		Options          func() protoreflect.ProtoMessage  		StringName       stringName  		IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto -		IsPacked         bool // promoted from google.protobuf.FieldOptions  		Default          defaultValue  		Enum             protoreflect.EnumDescriptor  		Message          protoreflect.MessageDescriptor @@ -461,7 +449,16 @@ func (xd *Extension) HasPresence() bool                     { return xd.L1.Cardi  func (xd *Extension) HasOptionalKeyword() bool {  	return (xd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && xd.L1.Cardinality == protoreflect.Optional) || xd.lazyInit().IsProto3Optional  } -func (xd *Extension) IsPacked() bool                         { return xd.lazyInit().IsPacked } +func (xd *Extension) IsPacked() bool { +	if xd.L1.Cardinality != protoreflect.Repeated { +		return false +	} +	switch xd.L1.Kind { +	case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind: +		return false +	} +	return xd.L1.EditionFeatures.IsPacked +}  func (xd *Extension) IsExtension() bool                      { return true }  func (xd *Extension) IsWeak() bool                           { return false }  func (xd *Extension) IsList() bool                           { return xd.Cardinality() == protoreflect.Repeated } @@ -542,8 +539,9 @@ func (md *Method) ProtoInternal(pragma.DoNotImplement)     {}  // Surrogate files are can be used to create standalone descriptors  // where the syntax is only information derived from the parent file.  var ( -	SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}} -	SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}} +	SurrogateProto2      = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}} +	SurrogateProto3      = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}} +	SurrogateEdition2023 = &File{L1: FileL1{Syntax: protoreflect.Editions, Edition: Edition2023}, L2: &FileL2{}}  )  type ( @@ -585,6 +583,34 @@ func (s *stringName) InitJSON(name string) {  	s.nameJSON = name  } +// Returns true if this field is structured like the synthetic field of a proto2 +// group. This allows us to expand our treatment of delimited fields without +// breaking proto2 files that have been upgraded to editions. +func isGroupLike(fd protoreflect.FieldDescriptor) bool { +	// Groups are always group types. +	if fd.Kind() != protoreflect.GroupKind { +		return false +	} + +	// Group fields are always the lowercase type name. +	if strings.ToLower(string(fd.Message().Name())) != string(fd.Name()) { +		return false +	} + +	// Groups could only be defined in the same file they're used. +	if fd.Message().ParentFile() != fd.ParentFile() { +		return false +	} + +	// Group messages are always defined in the same scope as the field.  File +	// level extensions will compare NULL == NULL here, which is why the file +	// comparison above is necessary to ensure both come from the same file. +	if fd.IsExtension() { +		return fd.Parent() == fd.Message().Parent() +	} +	return fd.ContainingMessage() == fd.Message().Parent() +} +  func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {  	s.once.Do(func() {  		if fd.IsExtension() { @@ -605,7 +631,7 @@ func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {  			// Format the text name.  			s.nameText = string(fd.Name()) -			if fd.Kind() == protoreflect.GroupKind { +			if isGroupLike(fd) {  				s.nameText = string(fd.Message().Name())  			}  		} diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go index 237e64fd2..3bc3b1cdf 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go @@ -113,8 +113,10 @@ func (fd *File) unmarshalSeed(b []byte) {  				switch string(v) {  				case "proto2":  					fd.L1.Syntax = protoreflect.Proto2 +					fd.L1.Edition = EditionProto2  				case "proto3":  					fd.L1.Syntax = protoreflect.Proto3 +					fd.L1.Edition = EditionProto3  				case "editions":  					fd.L1.Syntax = protoreflect.Editions  				default: @@ -177,11 +179,10 @@ func (fd *File) unmarshalSeed(b []byte) {  	// If syntax is missing, it is assumed to be proto2.  	if fd.L1.Syntax == 0 {  		fd.L1.Syntax = protoreflect.Proto2 +		fd.L1.Edition = EditionProto2  	} -	if fd.L1.Syntax == protoreflect.Editions { -		fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition) -	} +	fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition)  	// Parse editions features from options if any  	if options != nil { @@ -267,6 +268,7 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protorefl  	ed.L0.ParentFile = pf  	ed.L0.Parent = pd  	ed.L0.Index = i +	ed.L1.EditionFeatures = featuresFromParentDesc(ed.Parent())  	var numValues int  	for b := b; len(b) > 0; { @@ -443,6 +445,7 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd prot  	xd.L0.ParentFile = pf  	xd.L0.Parent = pd  	xd.L0.Index = i +	xd.L1.EditionFeatures = featuresFromParentDesc(pd)  	for len(b) > 0 {  		num, typ, n := protowire.ConsumeTag(b) @@ -467,6 +470,38 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd prot  				xd.L0.FullName = appendFullName(sb, pd.FullName(), v)  			case genid.FieldDescriptorProto_Extendee_field_number:  				xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v)) +			case genid.FieldDescriptorProto_Options_field_number: +				xd.unmarshalOptions(v) +			} +		default: +			m := protowire.ConsumeFieldValue(num, typ, b) +			b = b[m:] +		} +	} + +	if xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded { +		xd.L1.Kind = protoreflect.GroupKind +	} +} + +func (xd *Extension) unmarshalOptions(b []byte) { +	for len(b) > 0 { +		num, typ, n := protowire.ConsumeTag(b) +		b = b[n:] +		switch typ { +		case protowire.VarintType: +			v, m := protowire.ConsumeVarint(b) +			b = b[m:] +			switch num { +			case genid.FieldOptions_Packed_field_number: +				xd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v) +			} +		case protowire.BytesType: +			v, m := protowire.ConsumeBytes(b) +			b = b[m:] +			switch num { +			case genid.FieldOptions_Features_field_number: +				xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures)  			}  		default:  			m := protowire.ConsumeFieldValue(num, typ, b) diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index 482a61cc1..570181eb4 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -466,10 +466,10 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref  			b = b[m:]  		}  	} -	if fd.Syntax() == protoreflect.Editions && fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded { +	if fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded {  		fd.L1.Kind = protoreflect.GroupKind  	} -	if fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsLegacyRequired { +	if fd.L1.EditionFeatures.IsLegacyRequired {  		fd.L1.Cardinality = protoreflect.Required  	}  	if rawTypeName != nil { @@ -496,13 +496,11 @@ func (fd *Field) unmarshalOptions(b []byte) {  			b = b[m:]  			switch num {  			case genid.FieldOptions_Packed_field_number: -				fd.L1.HasPacked = true -				fd.L1.IsPacked = protowire.DecodeBool(v) +				fd.L1.EditionFeatures.IsPacked = protowire.DecodeBool(v)  			case genid.FieldOptions_Weak_field_number:  				fd.L1.IsWeak = protowire.DecodeBool(v)  			case FieldOptions_EnforceUTF8: -				fd.L1.HasEnforceUTF8 = true -				fd.L1.EnforceUTF8 = protowire.DecodeBool(v) +				fd.L1.EditionFeatures.IsUTF8Validated = protowire.DecodeBool(v)  			}  		case protowire.BytesType:  			v, m := protowire.ConsumeBytes(b) @@ -548,7 +546,6 @@ func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref  func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {  	var rawTypeName []byte  	var rawOptions []byte -	xd.L1.EditionFeatures = featuresFromParentDesc(xd.L1.Extendee)  	xd.L2 = new(ExtensionL2)  	for len(b) > 0 {  		num, typ, n := protowire.ConsumeTag(b) @@ -572,7 +569,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {  			case genid.FieldDescriptorProto_TypeName_field_number:  				rawTypeName = v  			case genid.FieldDescriptorProto_Options_field_number: -				xd.unmarshalOptions(v)  				rawOptions = appendOptions(rawOptions, v)  			}  		default: @@ -580,12 +576,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {  			b = b[m:]  		}  	} -	if xd.Syntax() == protoreflect.Editions && xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded { -		xd.L1.Kind = protoreflect.GroupKind -	} -	if xd.Syntax() == protoreflect.Editions && xd.L1.EditionFeatures.IsLegacyRequired { -		xd.L1.Cardinality = protoreflect.Required -	}  	if rawTypeName != nil {  		name := makeFullName(sb, rawTypeName)  		switch xd.L1.Kind { @@ -598,32 +588,6 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {  	xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)  } -func (xd *Extension) unmarshalOptions(b []byte) { -	for len(b) > 0 { -		num, typ, n := protowire.ConsumeTag(b) -		b = b[n:] -		switch typ { -		case protowire.VarintType: -			v, m := protowire.ConsumeVarint(b) -			b = b[m:] -			switch num { -			case genid.FieldOptions_Packed_field_number: -				xd.L2.IsPacked = protowire.DecodeBool(v) -			} -		case protowire.BytesType: -			v, m := protowire.ConsumeBytes(b) -			b = b[m:] -			switch num { -			case genid.FieldOptions_Features_field_number: -				xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures) -			} -		default: -			m := protowire.ConsumeFieldValue(num, typ, b) -			b = b[m:] -		} -	} -} -  func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {  	var rawMethods [][]byte  	var rawOptions []byte diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go index 0375a49d4..d1e16a26d 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go @@ -14,9 +14,13 @@ import (  )  var defaultsCache = make(map[Edition]EditionFeatures) +var defaultsKeys = []Edition{}  func init() {  	unmarshalEditionDefaults(editiondefaults.Defaults) +	SurrogateProto2.L1.EditionFeatures = getFeaturesFor(EditionProto2) +	SurrogateProto3.L1.EditionFeatures = getFeaturesFor(EditionProto3) +	SurrogateEdition2023.L1.EditionFeatures = getFeaturesFor(Edition2023)  }  func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures { @@ -110,6 +114,7 @@ func unmarshalEditionDefault(b []byte) {  		}  	}  	defaultsCache[ed] = fs +	defaultsKeys = append(defaultsKeys, ed)  }  func unmarshalEditionDefaults(b []byte) { @@ -135,8 +140,15 @@ func unmarshalEditionDefaults(b []byte) {  }  func getFeaturesFor(ed Edition) EditionFeatures { -	if def, ok := defaultsCache[ed]; ok { -		return def +	match := EditionUnknown +	for _, key := range defaultsKeys { +		if key > ed { +			break +		} +		match = key +	} +	if match == EditionUnknown { +		panic(fmt.Sprintf("unsupported edition: %v", ed))  	} -	panic(fmt.Sprintf("unsupported edition: %v", ed)) +	return defaultsCache[match]  } diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go index 28240ebc5..bfb3b8417 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go @@ -63,6 +63,7 @@ func (e PlaceholderEnum) Options() protoreflect.ProtoMessage        { return des  func (e PlaceholderEnum) Values() protoreflect.EnumValueDescriptors { return emptyEnumValues }  func (e PlaceholderEnum) ReservedNames() protoreflect.Names         { return emptyNames }  func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges   { return emptyEnumRanges } +func (e PlaceholderEnum) IsClosed() bool                            { return false }  func (e PlaceholderEnum) ProtoType(protoreflect.EnumDescriptor)     { return }  func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement)       { return } diff --git a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go index fd9015e8e..9a652a2b4 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go @@ -10,7 +10,7 @@ import (  	protoreflect "google.golang.org/protobuf/reflect/protoreflect"  ) -const File_reflect_protodesc_proto_go_features_proto = "reflect/protodesc/proto/go_features.proto" +const File_google_protobuf_go_features_proto = "google/protobuf/go_features.proto"  // Names for google.protobuf.GoFeatures.  const ( diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go index 3fadd241e..78ee47e44 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go @@ -233,9 +233,15 @@ func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {  }  func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) { +	calculatedSize := f.mi.sizePointer(p.Elem(), opts)  	b = protowire.AppendVarint(b, f.wiretag) -	b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts))) -	return f.mi.marshalAppendPointer(b, p.Elem(), opts) +	b = protowire.AppendVarint(b, uint64(calculatedSize)) +	before := len(b) +	b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts) +	if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil { +		return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) +	} +	return b, err  }  func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { @@ -262,14 +268,21 @@ func isInitMessageInfo(p pointer, f *coderFieldInfo) error {  	return f.mi.checkInitializedPointer(p.Elem())  } -func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int { -	return protowire.SizeBytes(proto.Size(m)) + tagsize +func sizeMessage(m proto.Message, tagsize int, opts marshalOptions) int { +	return protowire.SizeBytes(opts.Options().Size(m)) + tagsize  }  func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) { +	mopts := opts.Options() +	calculatedSize := mopts.Size(m)  	b = protowire.AppendVarint(b, wiretag) -	b = protowire.AppendVarint(b, uint64(proto.Size(m))) -	return opts.Options().MarshalAppend(b, m) +	b = protowire.AppendVarint(b, uint64(calculatedSize)) +	before := len(b) +	b, err := mopts.MarshalAppend(b, m) +	if measuredSize := len(b) - before; calculatedSize != measuredSize && err == nil { +		return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) +	} +	return b, err  }  func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) { @@ -405,8 +418,8 @@ func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf  	return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)  } -func sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int { -	return 2*tagsize + proto.Size(m) +func sizeGroup(m proto.Message, tagsize int, opts marshalOptions) int { +	return 2*tagsize + opts.Options().Size(m)  }  func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) { @@ -482,10 +495,14 @@ func appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshal  		b = protowire.AppendVarint(b, f.wiretag)  		siz := f.mi.sizePointer(v, opts)  		b = protowire.AppendVarint(b, uint64(siz)) +		before := len(b)  		b, err = f.mi.marshalAppendPointer(b, v, opts)  		if err != nil {  			return b, err  		} +		if measuredSize := len(b) - before; siz != measuredSize { +			return nil, errors.MismatchedSizeCalculation(siz, measuredSize) +		}  	}  	return b, nil  } @@ -520,28 +537,34 @@ func isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error {  	return nil  } -func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int { +func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, opts marshalOptions) int { +	mopts := opts.Options()  	s := p.PointerSlice()  	n := 0  	for _, v := range s {  		m := asMessage(v.AsValueOf(goType.Elem())) -		n += protowire.SizeBytes(proto.Size(m)) + tagsize +		n += protowire.SizeBytes(mopts.Size(m)) + tagsize  	}  	return n  }  func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) { +	mopts := opts.Options()  	s := p.PointerSlice()  	var err error  	for _, v := range s {  		m := asMessage(v.AsValueOf(goType.Elem()))  		b = protowire.AppendVarint(b, wiretag) -		siz := proto.Size(m) +		siz := mopts.Size(m)  		b = protowire.AppendVarint(b, uint64(siz)) -		b, err = opts.Options().MarshalAppend(b, m) +		before := len(b) +		b, err = mopts.MarshalAppend(b, m)  		if err != nil {  			return b, err  		} +		if measuredSize := len(b) - before; siz != measuredSize { +			return nil, errors.MismatchedSizeCalculation(siz, measuredSize) +		}  	}  	return b, nil  } @@ -582,11 +605,12 @@ func isInitMessageSlice(p pointer, goType reflect.Type) error {  // Slices of messages  func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int { +	mopts := opts.Options()  	list := listv.List()  	n := 0  	for i, llen := 0, list.Len(); i < llen; i++ {  		m := list.Get(i).Message().Interface() -		n += protowire.SizeBytes(proto.Size(m)) + tagsize +		n += protowire.SizeBytes(mopts.Size(m)) + tagsize  	}  	return n  } @@ -597,13 +621,17 @@ func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64,  	for i, llen := 0, list.Len(); i < llen; i++ {  		m := list.Get(i).Message().Interface()  		b = protowire.AppendVarint(b, wiretag) -		siz := proto.Size(m) +		siz := mopts.Size(m)  		b = protowire.AppendVarint(b, uint64(siz)) +		before := len(b)  		var err error  		b, err = mopts.MarshalAppend(b, m)  		if err != nil {  			return b, err  		} +		if measuredSize := len(b) - before; siz != measuredSize { +			return nil, errors.MismatchedSizeCalculation(siz, measuredSize) +		}  	}  	return b, nil  } @@ -651,11 +679,12 @@ var coderMessageSliceValue = valueCoderFuncs{  }  func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int { +	mopts := opts.Options()  	list := listv.List()  	n := 0  	for i, llen := 0, list.Len(); i < llen; i++ {  		m := list.Get(i).Message().Interface() -		n += 2*tagsize + proto.Size(m) +		n += 2*tagsize + mopts.Size(m)  	}  	return n  } @@ -738,12 +767,13 @@ func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type)  	}  } -func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int { +func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, opts marshalOptions) int { +	mopts := opts.Options()  	s := p.PointerSlice()  	n := 0  	for _, v := range s {  		m := asMessage(v.AsValueOf(messageType.Elem())) -		n += 2*tagsize + proto.Size(m) +		n += 2*tagsize + mopts.Size(m)  	}  	return n  } diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go index 111b9d16f..fb35f0bae 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go @@ -9,6 +9,7 @@ import (  	"sort"  	"google.golang.org/protobuf/encoding/protowire" +	"google.golang.org/protobuf/internal/errors"  	"google.golang.org/protobuf/internal/genid"  	"google.golang.org/protobuf/reflect/protoreflect"  ) @@ -240,11 +241,16 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder  		size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)  		size += mapi.valFuncs.size(val, mapValTagSize, opts)  		b = protowire.AppendVarint(b, uint64(size)) +		before := len(b)  		b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)  		if err != nil {  			return nil, err  		} -		return mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts) +		b, err = mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts) +		if measuredSize := len(b) - before; size != measuredSize && err == nil { +			return nil, errors.MismatchedSizeCalculation(size, measuredSize) +		} +		return b, err  	} else {  		key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()  		val := pointerOfValue(valrv) @@ -259,7 +265,12 @@ func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coder  		}  		b = protowire.AppendVarint(b, mapi.valWiretag)  		b = protowire.AppendVarint(b, uint64(valSize)) -		return f.mi.marshalAppendPointer(b, val, opts) +		before := len(b) +		b, err = f.mi.marshalAppendPointer(b, val, opts) +		if measuredSize := len(b) - before; valSize != measuredSize && err == nil { +			return nil, errors.MismatchedSizeCalculation(valSize, measuredSize) +		} +		return b, err  	}  } diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go index c2a803bb2..c1c33d005 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go @@ -167,6 +167,7 @@ func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {  	ed := &filedesc.Enum{L2: new(filedesc.EnumL2)}  	ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum  	ed.L0.ParentFile = filedesc.SurrogateProto3 +	ed.L1.EditionFeatures = ed.L0.ParentFile.L1.EditionFeatures  	ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})  	// TODO: Use the presence of a UnmarshalJSON method to determine proto2? diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go index 87b30d050..6e8677ee6 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go @@ -118,7 +118,7 @@ func (xi *ExtensionInfo) initFromLegacy() {  	xd.L1.Number = protoreflect.FieldNumber(xi.Field)  	xd.L1.Cardinality = fd.L1.Cardinality  	xd.L1.Kind = fd.L1.Kind -	xd.L2.IsPacked = fd.L1.IsPacked +	xd.L1.EditionFeatures = fd.L1.EditionFeatures  	xd.L2.Default = fd.L1.Default  	xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)  	xd.L2.Enum = ed diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go index 9ab091086..b649f1124 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go @@ -7,7 +7,7 @@ package impl  import (  	"bytes"  	"compress/gzip" -	"io/ioutil" +	"io"  	"sync"  	"google.golang.org/protobuf/internal/filedesc" @@ -51,7 +51,7 @@ func legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor {  	if err != nil {  		panic(err)  	} -	b2, err := ioutil.ReadAll(zr) +	b2, err := io.ReadAll(zr)  	if err != nil {  		panic(err)  	} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go index 2ab2c6297..950e9a1fe 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +++ b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go @@ -204,6 +204,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName  		}  	} +	md.L1.EditionFeatures = md.L0.ParentFile.L1.EditionFeatures  	// Obtain a list of oneof wrapper types.  	var oneofWrappers []reflect.Type  	methods := make([]reflect.Method, 0, 2) @@ -250,6 +251,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName  			od := &md.L2.Oneofs.List[n]  			od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))  			od.L0.ParentFile = md.L0.ParentFile +			od.L1.EditionFeatures = md.L1.EditionFeatures  			od.L0.Parent = md  			od.L0.Index = n @@ -260,6 +262,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName  						aberrantAppendField(md, f.Type, tag, "", "")  						fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]  						fd.L1.ContainingOneof = od +						fd.L1.EditionFeatures = od.L1.EditionFeatures  						od.L1.Fields.List = append(od.L1.Fields.List, fd)  					}  				} @@ -307,14 +310,14 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,  	fd.L0.Parent = md  	fd.L0.Index = n -	if fd.L1.IsWeak || fd.L1.HasPacked { +	if fd.L1.IsWeak || fd.L1.EditionFeatures.IsPacked {  		fd.L1.Options = func() protoreflect.ProtoMessage {  			opts := descopts.Field.ProtoReflect().New()  			if fd.L1.IsWeak {  				opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))  			} -			if fd.L1.HasPacked { -				opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.IsPacked)) +			if fd.L1.EditionFeatures.IsPacked { +				opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.EditionFeatures.IsPacked))  			}  			return opts.Interface()  		} @@ -344,6 +347,7 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,  				md2.L0.ParentFile = md.L0.ParentFile  				md2.L0.Parent = md  				md2.L0.Index = n +				md2.L1.EditionFeatures = md.L1.EditionFeatures  				md2.L1.IsMapEntry = true  				md2.L2.Options = func() protoreflect.ProtoMessage { diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go index d9ea010be..a6f0dbdad 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go @@ -247,11 +247,10 @@ func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.V  		}  	}  } -func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) { +func (m *extensionMap) Has(xd protoreflect.ExtensionTypeDescriptor) (ok bool) {  	if m == nil {  		return false  	} -	xd := xt.TypeDescriptor()  	x, ok := (*m)[int32(xd.Number())]  	if !ok {  		return false @@ -261,25 +260,22 @@ func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) {  		return x.Value().List().Len() > 0  	case xd.IsMap():  		return x.Value().Map().Len() > 0 -	case xd.Message() != nil: -		return x.Value().Message().IsValid()  	}  	return true  } -func (m *extensionMap) Clear(xt protoreflect.ExtensionType) { -	delete(*m, int32(xt.TypeDescriptor().Number())) +func (m *extensionMap) Clear(xd protoreflect.ExtensionTypeDescriptor) { +	delete(*m, int32(xd.Number()))  } -func (m *extensionMap) Get(xt protoreflect.ExtensionType) protoreflect.Value { -	xd := xt.TypeDescriptor() +func (m *extensionMap) Get(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value {  	if m != nil {  		if x, ok := (*m)[int32(xd.Number())]; ok {  			return x.Value()  		}  	} -	return xt.Zero() +	return xd.Type().Zero()  } -func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) { -	xd := xt.TypeDescriptor() +func (m *extensionMap) Set(xd protoreflect.ExtensionTypeDescriptor, v protoreflect.Value) { +	xt := xd.Type()  	isValid := true  	switch {  	case !xt.IsValidValue(v): @@ -292,7 +288,7 @@ func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value)  		isValid = v.Message().IsValid()  	}  	if !isValid { -		panic(fmt.Sprintf("%v: assigning invalid value", xt.TypeDescriptor().FullName())) +		panic(fmt.Sprintf("%v: assigning invalid value", xd.FullName()))  	}  	if *m == nil { @@ -302,16 +298,15 @@ func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value)  	x.Set(xt, v)  	(*m)[int32(xd.Number())] = x  } -func (m *extensionMap) Mutable(xt protoreflect.ExtensionType) protoreflect.Value { -	xd := xt.TypeDescriptor() +func (m *extensionMap) Mutable(xd protoreflect.ExtensionTypeDescriptor) protoreflect.Value {  	if xd.Kind() != protoreflect.MessageKind && xd.Kind() != protoreflect.GroupKind && !xd.IsList() && !xd.IsMap() {  		panic("invalid Mutable on field with non-composite type")  	}  	if x, ok := (*m)[int32(xd.Number())]; ok {  		return x.Value()  	} -	v := xt.New() -	m.Set(xt, v) +	v := xd.Type().New() +	m.Set(xd, v)  	return v  } @@ -428,7 +423,7 @@ func (m *messageIfaceWrapper) protoUnwrap() interface{} {  // checkField verifies that the provided field descriptor is valid.  // Exactly one of the returned values is populated. -func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionType) { +func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionTypeDescriptor) {  	var fi *fieldInfo  	if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {  		fi = mi.denseFields[n] @@ -457,7 +452,7 @@ func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo,  		if !ok {  			panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))  		} -		return nil, xtd.Type() +		return nil, xtd  	}  	panic(fmt.Sprintf("field %v is invalid", fd.FullName()))  } diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go index 741d6e5b6..29ba6bd35 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +++ b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go @@ -27,8 +27,9 @@ func (m *messageState) protoUnwrap() interface{} {  	return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())  }  func (m *messageState) ProtoMethods() *protoiface.Methods { -	m.messageInfo().init() -	return &m.messageInfo().methods +	mi := m.messageInfo() +	mi.init() +	return &mi.methods  }  // ProtoMessageInfo is a pseudo-internal API for allowing the v1 code @@ -41,8 +42,9 @@ func (m *messageState) ProtoMessageInfo() *MessageInfo {  }  func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -	m.messageInfo().init() -	for _, ri := range m.messageInfo().rangeInfos { +	mi := m.messageInfo() +	mi.init() +	for _, ri := range mi.rangeInfos {  		switch ri := ri.(type) {  		case *fieldInfo:  			if ri.has(m.pointer()) { @@ -52,77 +54,86 @@ func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.V  			}  		case *oneofInfo:  			if n := ri.which(m.pointer()); n > 0 { -				fi := m.messageInfo().fields[n] +				fi := mi.fields[n]  				if !f(fi.fieldDesc, fi.get(m.pointer())) {  					return  				}  			}  		}  	} -	m.messageInfo().extensionMap(m.pointer()).Range(f) +	mi.extensionMap(m.pointer()).Range(f)  }  func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.has(m.pointer())  	} else { -		return m.messageInfo().extensionMap(m.pointer()).Has(xt) +		return mi.extensionMap(m.pointer()).Has(xd)  	}  }  func (m *messageState) Clear(fd protoreflect.FieldDescriptor) { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		fi.clear(m.pointer())  	} else { -		m.messageInfo().extensionMap(m.pointer()).Clear(xt) +		mi.extensionMap(m.pointer()).Clear(xd)  	}  }  func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.get(m.pointer())  	} else { -		return m.messageInfo().extensionMap(m.pointer()).Get(xt) +		return mi.extensionMap(m.pointer()).Get(xd)  	}  }  func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		fi.set(m.pointer(), v)  	} else { -		m.messageInfo().extensionMap(m.pointer()).Set(xt, v) +		mi.extensionMap(m.pointer()).Set(xd, v)  	}  }  func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.mutable(m.pointer())  	} else { -		return m.messageInfo().extensionMap(m.pointer()).Mutable(xt) +		return mi.extensionMap(m.pointer()).Mutable(xd)  	}  }  func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.newField()  	} else { -		return xt.New() +		return xd.Type().New()  	}  }  func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { -	m.messageInfo().init() -	if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { +	mi := m.messageInfo() +	mi.init() +	if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {  		return od.Fields().ByNumber(oi.which(m.pointer()))  	}  	panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))  }  func (m *messageState) GetUnknown() protoreflect.RawFields { -	m.messageInfo().init() -	return m.messageInfo().getUnknown(m.pointer()) +	mi := m.messageInfo() +	mi.init() +	return mi.getUnknown(m.pointer())  }  func (m *messageState) SetUnknown(b protoreflect.RawFields) { -	m.messageInfo().init() -	m.messageInfo().setUnknown(m.pointer(), b) +	mi := m.messageInfo() +	mi.init() +	mi.setUnknown(m.pointer(), b)  }  func (m *messageState) IsValid() bool {  	return !m.pointer().IsNil() @@ -147,8 +158,9 @@ func (m *messageReflectWrapper) protoUnwrap() interface{} {  	return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())  }  func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods { -	m.messageInfo().init() -	return &m.messageInfo().methods +	mi := m.messageInfo() +	mi.init() +	return &mi.methods  }  // ProtoMessageInfo is a pseudo-internal API for allowing the v1 code @@ -161,8 +173,9 @@ func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {  }  func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -	m.messageInfo().init() -	for _, ri := range m.messageInfo().rangeInfos { +	mi := m.messageInfo() +	mi.init() +	for _, ri := range mi.rangeInfos {  		switch ri := ri.(type) {  		case *fieldInfo:  			if ri.has(m.pointer()) { @@ -172,77 +185,86 @@ func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, proto  			}  		case *oneofInfo:  			if n := ri.which(m.pointer()); n > 0 { -				fi := m.messageInfo().fields[n] +				fi := mi.fields[n]  				if !f(fi.fieldDesc, fi.get(m.pointer())) {  					return  				}  			}  		}  	} -	m.messageInfo().extensionMap(m.pointer()).Range(f) +	mi.extensionMap(m.pointer()).Range(f)  }  func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.has(m.pointer())  	} else { -		return m.messageInfo().extensionMap(m.pointer()).Has(xt) +		return mi.extensionMap(m.pointer()).Has(xd)  	}  }  func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		fi.clear(m.pointer())  	} else { -		m.messageInfo().extensionMap(m.pointer()).Clear(xt) +		mi.extensionMap(m.pointer()).Clear(xd)  	}  }  func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.get(m.pointer())  	} else { -		return m.messageInfo().extensionMap(m.pointer()).Get(xt) +		return mi.extensionMap(m.pointer()).Get(xd)  	}  }  func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		fi.set(m.pointer(), v)  	} else { -		m.messageInfo().extensionMap(m.pointer()).Set(xt, v) +		mi.extensionMap(m.pointer()).Set(xd, v)  	}  }  func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.mutable(m.pointer())  	} else { -		return m.messageInfo().extensionMap(m.pointer()).Mutable(xt) +		return mi.extensionMap(m.pointer()).Mutable(xd)  	}  }  func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { -	m.messageInfo().init() -	if fi, xt := m.messageInfo().checkField(fd); fi != nil { +	mi := m.messageInfo() +	mi.init() +	if fi, xd := mi.checkField(fd); fi != nil {  		return fi.newField()  	} else { -		return xt.New() +		return xd.Type().New()  	}  }  func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { -	m.messageInfo().init() -	if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od { +	mi := m.messageInfo() +	mi.init() +	if oi := mi.oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {  		return od.Fields().ByNumber(oi.which(m.pointer()))  	}  	panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))  }  func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields { -	m.messageInfo().init() -	return m.messageInfo().getUnknown(m.pointer()) +	mi := m.messageInfo() +	mi.init() +	return mi.getUnknown(m.pointer())  }  func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) { -	m.messageInfo().init() -	m.messageInfo().setUnknown(m.pointer(), b) +	mi := m.messageInfo() +	mi.init() +	mi.setUnknown(m.pointer(), b)  }  func (m *messageReflectWrapper) IsValid() bool {  	return !m.pointer().IsNil() diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index a50fcfb49..fc6bfc396 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -51,7 +51,7 @@ import (  //  10. Send out the CL for review and submit it.  const (  	Major      = 1 -	Minor      = 33 +	Minor      = 34  	Patch      = 0  	PreRelease = ""  ) diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go index e5b03b567..d75a6534c 100644 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ b/vendor/google.golang.org/protobuf/proto/decode.go @@ -51,6 +51,8 @@ type UnmarshalOptions struct {  // Unmarshal parses the wire-format message in b and places the result in m.  // The provided message must be mutable (e.g., a non-nil pointer to a message). +// +// See the [UnmarshalOptions] type if you need more control.  func Unmarshal(b []byte, m Message) error {  	_, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect())  	return err diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go index 4fed202f9..1f847bcc3 100644 --- a/vendor/google.golang.org/protobuf/proto/encode.go +++ b/vendor/google.golang.org/protobuf/proto/encode.go @@ -5,12 +5,17 @@  package proto  import ( +	"errors" +	"fmt" +  	"google.golang.org/protobuf/encoding/protowire"  	"google.golang.org/protobuf/internal/encoding/messageset"  	"google.golang.org/protobuf/internal/order"  	"google.golang.org/protobuf/internal/pragma"  	"google.golang.org/protobuf/reflect/protoreflect"  	"google.golang.org/protobuf/runtime/protoiface" + +	protoerrors "google.golang.org/protobuf/internal/errors"  )  // MarshalOptions configures the marshaler. @@ -70,7 +75,32 @@ type MarshalOptions struct {  	UseCachedSize bool  } +// flags turns the specified MarshalOptions (user-facing) into +// protoiface.MarshalInputFlags (used internally by the marshaler). +// +// See impl.marshalOptions.Options for the inverse operation. +func (o MarshalOptions) flags() protoiface.MarshalInputFlags { +	var flags protoiface.MarshalInputFlags + +	// Note: o.AllowPartial is always forced to true by MarshalOptions.marshal, +	// which is why it is not a part of MarshalInputFlags. + +	if o.Deterministic { +		flags |= protoiface.MarshalDeterministic +	} + +	if o.UseCachedSize { +		flags |= protoiface.MarshalUseCachedSize +	} + +	return flags +} +  // Marshal returns the wire-format encoding of m. +// +// This is the most common entry point for encoding a Protobuf message. +// +// See the [MarshalOptions] type if you need more control.  func Marshal(m Message) ([]byte, error) {  	// Treat nil message interface as an empty message; nothing to output.  	if m == nil { @@ -116,6 +146,9 @@ func emptyBytesForMessage(m Message) []byte {  // MarshalAppend appends the wire-format encoding of m to b,  // returning the result. +// +// This is a less common entry point than [Marshal], which is only needed if you +// need to supply your own buffers for performance reasons.  func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {  	// Treat nil message interface as an empty message; nothing to append.  	if m == nil { @@ -145,12 +178,7 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac  		in := protoiface.MarshalInput{  			Message: m,  			Buf:     b, -		} -		if o.Deterministic { -			in.Flags |= protoiface.MarshalDeterministic -		} -		if o.UseCachedSize { -			in.Flags |= protoiface.MarshalUseCachedSize +			Flags:   o.flags(),  		}  		if methods.Size != nil {  			sout := methods.Size(protoiface.SizeInput{ @@ -168,6 +196,10 @@ func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoifac  		out.Buf, err = o.marshalMessageSlow(b, m)  	}  	if err != nil { +		var mismatch *protoerrors.SizeMismatchError +		if errors.As(err, &mismatch) { +			return out, fmt.Errorf("marshaling %s: %v", string(m.Descriptor().FullName()), err) +		}  		return out, err  	}  	if allowPartial { diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go index 17899a3a7..c9c8721a6 100644 --- a/vendor/google.golang.org/protobuf/proto/extension.go +++ b/vendor/google.golang.org/protobuf/proto/extension.go @@ -11,18 +11,21 @@ import (  // HasExtension reports whether an extension field is populated.  // It returns false if m is invalid or if xt does not extend m.  func HasExtension(m Message, xt protoreflect.ExtensionType) bool { -	// Treat nil message interface as an empty message; no populated fields. -	if m == nil { +	// Treat nil message interface or descriptor as an empty message; no populated +	// fields. +	if m == nil || xt == nil {  		return false  	}  	// As a special-case, we reports invalid or mismatching descriptors  	// as always not being populated (since they aren't). -	if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() { +	mr := m.ProtoReflect() +	xd := xt.TypeDescriptor() +	if mr.Descriptor() != xd.ContainingMessage() {  		return false  	} -	return m.ProtoReflect().Has(xt.TypeDescriptor()) +	return mr.Has(xd)  }  // ClearExtension clears an extension field such that subsequent diff --git a/vendor/google.golang.org/protobuf/proto/messageset.go b/vendor/google.golang.org/protobuf/proto/messageset.go index 312d5d45c..575d14831 100644 --- a/vendor/google.golang.org/protobuf/proto/messageset.go +++ b/vendor/google.golang.org/protobuf/proto/messageset.go @@ -47,11 +47,16 @@ func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]b  func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {  	b = messageset.AppendFieldStart(b, fd.Number())  	b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType) -	b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface()))) +	calculatedSize := o.Size(value.Message().Interface()) +	b = protowire.AppendVarint(b, uint64(calculatedSize)) +	before := len(b)  	b, err := o.marshalMessage(b, value.Message())  	if err != nil {  		return b, err  	} +	if measuredSize := len(b) - before; calculatedSize != measuredSize { +		return nil, errors.MismatchedSizeCalculation(calculatedSize, measuredSize) +	}  	b = messageset.AppendFieldEnd(b)  	return b, nil  } diff --git a/vendor/google.golang.org/protobuf/proto/size.go b/vendor/google.golang.org/protobuf/proto/size.go index f1692b49b..052fb5ae3 100644 --- a/vendor/google.golang.org/protobuf/proto/size.go +++ b/vendor/google.golang.org/protobuf/proto/size.go @@ -34,6 +34,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) {  	if methods != nil && methods.Size != nil {  		out := methods.Size(protoiface.SizeInput{  			Message: m, +			Flags:   o.flags(),  		})  		return out.Size  	} @@ -42,6 +43,7 @@ func (o MarshalOptions) size(m protoreflect.Message) (size int) {  		// This case is mainly used for legacy types with a Marshal method.  		out, _ := methods.Marshal(protoiface.MarshalInput{  			Message: m, +			Flags:   o.flags(),  		})  		return len(out.Buf)  	} diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go index 00b01fbd8..c85bfaa5b 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go @@ -161,7 +161,7 @@ const (  // 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 diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go index 60ff62b4c..5b80afe52 100644 --- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +++ b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go @@ -544,6 +544,12 @@ 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) } | 
