mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
ci: package dependencies in actions/retest
these dependencies were not updated and this commit update the same. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
71c4ae542c
commit
a2215683e1
68
actions/retest/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
generated
vendored
68
actions/retest/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
generated
vendored
@ -14,7 +14,7 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/internal/detrand"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type list interface {
|
||||
@ -30,35 +30,37 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||
if isRoot {
|
||||
var name string
|
||||
switch vs.(type) {
|
||||
case pref.Names:
|
||||
case protoreflect.Names:
|
||||
name = "Names"
|
||||
case pref.FieldNumbers:
|
||||
case protoreflect.FieldNumbers:
|
||||
name = "FieldNumbers"
|
||||
case pref.FieldRanges:
|
||||
case protoreflect.FieldRanges:
|
||||
name = "FieldRanges"
|
||||
case pref.EnumRanges:
|
||||
case protoreflect.EnumRanges:
|
||||
name = "EnumRanges"
|
||||
case pref.FileImports:
|
||||
case protoreflect.FileImports:
|
||||
name = "FileImports"
|
||||
case pref.Descriptor:
|
||||
case protoreflect.Descriptor:
|
||||
name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s"
|
||||
default:
|
||||
name = reflect.ValueOf(vs).Elem().Type().Name()
|
||||
}
|
||||
start, end = name+"{", "}"
|
||||
}
|
||||
|
||||
var ss []string
|
||||
switch vs := vs.(type) {
|
||||
case pref.Names:
|
||||
case protoreflect.Names:
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
||||
}
|
||||
return start + joinStrings(ss, false) + end
|
||||
case pref.FieldNumbers:
|
||||
case protoreflect.FieldNumbers:
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
ss = append(ss, fmt.Sprint(vs.Get(i)))
|
||||
}
|
||||
return start + joinStrings(ss, false) + end
|
||||
case pref.FieldRanges:
|
||||
case protoreflect.FieldRanges:
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
r := vs.Get(i)
|
||||
if r[0]+1 == r[1] {
|
||||
@ -68,7 +70,7 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||
}
|
||||
}
|
||||
return start + joinStrings(ss, false) + end
|
||||
case pref.EnumRanges:
|
||||
case protoreflect.EnumRanges:
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
r := vs.Get(i)
|
||||
if r[0] == r[1] {
|
||||
@ -78,7 +80,7 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||
}
|
||||
}
|
||||
return start + joinStrings(ss, false) + end
|
||||
case pref.FileImports:
|
||||
case protoreflect.FileImports:
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
var rs records
|
||||
rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak")
|
||||
@ -86,11 +88,11 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||
}
|
||||
return start + joinStrings(ss, allowMulti) + end
|
||||
default:
|
||||
_, isEnumValue := vs.(pref.EnumValueDescriptors)
|
||||
_, isEnumValue := vs.(protoreflect.EnumValueDescriptors)
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
m := reflect.ValueOf(vs).MethodByName("Get")
|
||||
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
||||
ss = append(ss, formatDescOpt(v.(pref.Descriptor), false, allowMulti && !isEnumValue))
|
||||
ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue))
|
||||
}
|
||||
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
||||
}
|
||||
@ -104,20 +106,20 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||
//
|
||||
// Using a list allows us to print the accessors in a sensible order.
|
||||
var descriptorAccessors = map[reflect.Type][]string{
|
||||
reflect.TypeOf((*pref.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
|
||||
reflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
|
||||
reflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"},
|
||||
reflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
|
||||
reflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
|
||||
reflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {"Number"},
|
||||
reflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem(): {"Methods"},
|
||||
reflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"},
|
||||
reflect.TypeOf((*protoreflect.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
|
||||
reflect.TypeOf((*protoreflect.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
|
||||
reflect.TypeOf((*protoreflect.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"},
|
||||
reflect.TypeOf((*protoreflect.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
|
||||
reflect.TypeOf((*protoreflect.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
|
||||
reflect.TypeOf((*protoreflect.EnumValueDescriptor)(nil)).Elem(): {"Number"},
|
||||
reflect.TypeOf((*protoreflect.ServiceDescriptor)(nil)).Elem(): {"Methods"},
|
||||
reflect.TypeOf((*protoreflect.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"},
|
||||
}
|
||||
|
||||
func FormatDesc(s fmt.State, r rune, t pref.Descriptor) {
|
||||
func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) {
|
||||
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))
|
||||
}
|
||||
func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||
func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
||||
rv := reflect.ValueOf(t)
|
||||
rt := rv.MethodByName("ProtoType").Type().In(0)
|
||||
|
||||
@ -126,7 +128,7 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||
start = rt.Name() + "{"
|
||||
}
|
||||
|
||||
_, isFile := t.(pref.FileDescriptor)
|
||||
_, isFile := t.(protoreflect.FileDescriptor)
|
||||
rs := records{allowMulti: allowMulti}
|
||||
if t.IsPlaceholder() {
|
||||
if isFile {
|
||||
@ -144,7 +146,7 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||
rs.Append(rv, "Name")
|
||||
}
|
||||
switch t := t.(type) {
|
||||
case pref.FieldDescriptor:
|
||||
case protoreflect.FieldDescriptor:
|
||||
for _, s := range descriptorAccessors[rt] {
|
||||
switch s {
|
||||
case "MapKey":
|
||||
@ -154,9 +156,9 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||
case "MapValue":
|
||||
if v := t.MapValue(); v != nil {
|
||||
switch v.Kind() {
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())})
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())})
|
||||
default:
|
||||
rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()})
|
||||
@ -178,7 +180,7 @@ func formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {
|
||||
rs.Append(rv, s)
|
||||
}
|
||||
}
|
||||
case pref.OneofDescriptor:
|
||||
case protoreflect.OneofDescriptor:
|
||||
var ss []string
|
||||
fs := t.Fields()
|
||||
for i := 0; i < fs.Len(); i++ {
|
||||
@ -214,7 +216,7 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
||||
if !rv.IsValid() {
|
||||
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a))
|
||||
}
|
||||
if _, ok := rv.Interface().(pref.Value); ok {
|
||||
if _, ok := rv.Interface().(protoreflect.Value); ok {
|
||||
rv = rv.MethodByName("Interface").Call(nil)[0]
|
||||
if !rv.IsNil() {
|
||||
rv = rv.Elem()
|
||||
@ -248,9 +250,9 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
||||
switch v := v.(type) {
|
||||
case list:
|
||||
s = formatListOpt(v, false, rs.allowMulti)
|
||||
case pref.FieldDescriptor, pref.OneofDescriptor, pref.EnumValueDescriptor, pref.MethodDescriptor:
|
||||
s = string(v.(pref.Descriptor).Name())
|
||||
case pref.Descriptor:
|
||||
case protoreflect.FieldDescriptor, protoreflect.OneofDescriptor, protoreflect.EnumValueDescriptor, protoreflect.MethodDescriptor:
|
||||
s = string(v.(protoreflect.Descriptor).Name())
|
||||
case protoreflect.Descriptor:
|
||||
s = string(v.FullName())
|
||||
case string:
|
||||
s = strconv.Quote(v)
|
||||
|
8
actions/retest/vendor/google.golang.org/protobuf/internal/detrand/rand.go
generated
vendored
8
actions/retest/vendor/google.golang.org/protobuf/internal/detrand/rand.go
generated
vendored
@ -26,6 +26,14 @@ func Bool() bool {
|
||||
return randSeed%2 == 1
|
||||
}
|
||||
|
||||
// Intn returns a deterministically random integer between 0 and n-1, inclusive.
|
||||
func Intn(n int) int {
|
||||
if n <= 0 {
|
||||
panic("must be positive")
|
||||
}
|
||||
return int(randSeed % uint64(n))
|
||||
}
|
||||
|
||||
// randSeed is a best-effort at an approximate hash of the Go binary.
|
||||
var randSeed = binaryHash()
|
||||
|
||||
|
78
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
generated
vendored
78
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
generated
vendored
@ -15,8 +15,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
ptext "google.golang.org/protobuf/internal/encoding/text"
|
||||
errors "google.golang.org/protobuf/internal/errors"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// Format is the serialization format used to represent the default value.
|
||||
@ -35,56 +35,56 @@ const (
|
||||
|
||||
// Unmarshal deserializes the default string s according to the given kind k.
|
||||
// When k is an enum, a list of enum value descriptors must be provided.
|
||||
func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error) {
|
||||
func Unmarshal(s string, k protoreflect.Kind, evs protoreflect.EnumValueDescriptors, f Format) (protoreflect.Value, protoreflect.EnumValueDescriptor, error) {
|
||||
switch k {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if f == GoTag {
|
||||
switch s {
|
||||
case "1":
|
||||
return pref.ValueOfBool(true), nil, nil
|
||||
return protoreflect.ValueOfBool(true), nil, nil
|
||||
case "0":
|
||||
return pref.ValueOfBool(false), nil, nil
|
||||
return protoreflect.ValueOfBool(false), nil, nil
|
||||
}
|
||||
} else {
|
||||
switch s {
|
||||
case "true":
|
||||
return pref.ValueOfBool(true), nil, nil
|
||||
return protoreflect.ValueOfBool(true), nil, nil
|
||||
case "false":
|
||||
return pref.ValueOfBool(false), nil, nil
|
||||
return protoreflect.ValueOfBool(false), nil, nil
|
||||
}
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if f == GoTag {
|
||||
// Go tags use the numeric form of the enum value.
|
||||
if n, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||
if ev := evs.ByNumber(pref.EnumNumber(n)); ev != nil {
|
||||
return pref.ValueOfEnum(ev.Number()), ev, nil
|
||||
if ev := evs.ByNumber(protoreflect.EnumNumber(n)); ev != nil {
|
||||
return protoreflect.ValueOfEnum(ev.Number()), ev, nil
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Descriptor default_value use the enum identifier.
|
||||
ev := evs.ByName(pref.Name(s))
|
||||
ev := evs.ByName(protoreflect.Name(s))
|
||||
if ev != nil {
|
||||
return pref.ValueOfEnum(ev.Number()), ev, nil
|
||||
return protoreflect.ValueOfEnum(ev.Number()), ev, nil
|
||||
}
|
||||
}
|
||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
if v, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||
return pref.ValueOfInt32(int32(v)), nil, nil
|
||||
return protoreflect.ValueOfInt32(int32(v)), nil, nil
|
||||
}
|
||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
if v, err := strconv.ParseInt(s, 10, 64); err == nil {
|
||||
return pref.ValueOfInt64(int64(v)), nil, nil
|
||||
return protoreflect.ValueOfInt64(int64(v)), nil, nil
|
||||
}
|
||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
if v, err := strconv.ParseUint(s, 10, 32); err == nil {
|
||||
return pref.ValueOfUint32(uint32(v)), nil, nil
|
||||
return protoreflect.ValueOfUint32(uint32(v)), nil, nil
|
||||
}
|
||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
if v, err := strconv.ParseUint(s, 10, 64); err == nil {
|
||||
return pref.ValueOfUint64(uint64(v)), nil, nil
|
||||
return protoreflect.ValueOfUint64(uint64(v)), nil, nil
|
||||
}
|
||||
case pref.FloatKind, pref.DoubleKind:
|
||||
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||
var v float64
|
||||
var err error
|
||||
switch s {
|
||||
@ -98,29 +98,29 @@ func Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (
|
||||
v, err = strconv.ParseFloat(s, 64)
|
||||
}
|
||||
if err == nil {
|
||||
if k == pref.FloatKind {
|
||||
return pref.ValueOfFloat32(float32(v)), nil, nil
|
||||
if k == protoreflect.FloatKind {
|
||||
return protoreflect.ValueOfFloat32(float32(v)), nil, nil
|
||||
} else {
|
||||
return pref.ValueOfFloat64(float64(v)), nil, nil
|
||||
return protoreflect.ValueOfFloat64(float64(v)), nil, nil
|
||||
}
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
// String values are already unescaped and can be used as is.
|
||||
return pref.ValueOfString(s), nil, nil
|
||||
case pref.BytesKind:
|
||||
return protoreflect.ValueOfString(s), nil, nil
|
||||
case protoreflect.BytesKind:
|
||||
if b, ok := unmarshalBytes(s); ok {
|
||||
return pref.ValueOfBytes(b), nil, nil
|
||||
return protoreflect.ValueOfBytes(b), nil, nil
|
||||
}
|
||||
}
|
||||
return pref.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
|
||||
return protoreflect.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
|
||||
}
|
||||
|
||||
// Marshal serializes v as the default string according to the given kind k.
|
||||
// When specifying the Descriptor format for an enum kind, the associated
|
||||
// enum value descriptor must be provided.
|
||||
func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error) {
|
||||
func Marshal(v protoreflect.Value, ev protoreflect.EnumValueDescriptor, k protoreflect.Kind, f Format) (string, error) {
|
||||
switch k {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if f == GoTag {
|
||||
if v.Bool() {
|
||||
return "1", nil
|
||||
@ -134,17 +134,17 @@ func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (
|
||||
return "false", nil
|
||||
}
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if f == GoTag {
|
||||
return strconv.FormatInt(int64(v.Enum()), 10), nil
|
||||
} else {
|
||||
return string(ev.Name()), nil
|
||||
}
|
||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
return strconv.FormatInt(v.Int(), 10), nil
|
||||
case pref.Uint32Kind, pref.Fixed32Kind, pref.Uint64Kind, pref.Fixed64Kind:
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
return strconv.FormatUint(v.Uint(), 10), nil
|
||||
case pref.FloatKind, pref.DoubleKind:
|
||||
case protoreflect.FloatKind, protoreflect.DoubleKind:
|
||||
f := v.Float()
|
||||
switch {
|
||||
case math.IsInf(f, -1):
|
||||
@ -154,16 +154,16 @@ func Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (
|
||||
case math.IsNaN(f):
|
||||
return "nan", nil
|
||||
default:
|
||||
if k == pref.FloatKind {
|
||||
if k == protoreflect.FloatKind {
|
||||
return strconv.FormatFloat(f, 'g', -1, 32), nil
|
||||
} else {
|
||||
return strconv.FormatFloat(f, 'g', -1, 64), nil
|
||||
}
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
// String values are serialized as is without any escaping.
|
||||
return v.String(), nil
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
if s, ok := marshalBytes(v.Bytes()); ok {
|
||||
return s, nil
|
||||
}
|
||||
|
@ -10,11 +10,10 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// The MessageSet wire format is equivalent to a message defiend as follows,
|
||||
// The MessageSet wire format is equivalent to a message defined as follows,
|
||||
// where each Item defines an extension field with a field number of 'type_id'
|
||||
// and content of 'message'. MessageSet extensions must be non-repeated message
|
||||
// fields.
|
||||
@ -34,6 +33,7 @@ const (
|
||||
// ExtensionName is the field name for extensions of MessageSet.
|
||||
//
|
||||
// A valid MessageSet extension must be of the form:
|
||||
//
|
||||
// message MyMessage {
|
||||
// extend proto2.bridge.MessageSet {
|
||||
// optional MyMessage message_set_extension = 1234;
|
||||
@ -43,38 +43,22 @@ const (
|
||||
const ExtensionName = "message_set_extension"
|
||||
|
||||
// IsMessageSet returns whether the message uses the MessageSet wire format.
|
||||
func IsMessageSet(md pref.MessageDescriptor) bool {
|
||||
func IsMessageSet(md protoreflect.MessageDescriptor) bool {
|
||||
xmd, ok := md.(interface{ IsMessageSet() bool })
|
||||
return ok && xmd.IsMessageSet()
|
||||
}
|
||||
|
||||
// IsMessageSetExtension reports this field extends a MessageSet.
|
||||
func IsMessageSetExtension(fd pref.FieldDescriptor) bool {
|
||||
if fd.Name() != ExtensionName {
|
||||
// IsMessageSetExtension reports this field properly extends a MessageSet.
|
||||
func IsMessageSetExtension(fd protoreflect.FieldDescriptor) bool {
|
||||
switch {
|
||||
case fd.Name() != ExtensionName:
|
||||
return false
|
||||
case !IsMessageSet(fd.ContainingMessage()):
|
||||
return false
|
||||
case fd.FullName().Parent() != fd.Message().FullName():
|
||||
return false
|
||||
}
|
||||
if fd.FullName().Parent() != fd.Message().FullName() {
|
||||
return false
|
||||
}
|
||||
return IsMessageSet(fd.ContainingMessage())
|
||||
}
|
||||
|
||||
// FindMessageSetExtension locates a MessageSet extension field by name.
|
||||
// In text and JSON formats, the extension name used is the message itself.
|
||||
// The extension field name is derived by appending ExtensionName.
|
||||
func FindMessageSetExtension(r preg.ExtensionTypeResolver, s pref.FullName) (pref.ExtensionType, error) {
|
||||
name := s.Append(ExtensionName)
|
||||
xt, err := r.FindExtensionByName(name)
|
||||
if err != nil {
|
||||
if err == preg.NotFound {
|
||||
return nil, err
|
||||
}
|
||||
return nil, errors.Wrap(err, "%q", name)
|
||||
}
|
||||
if !IsMessageSetExtension(xt.TypeDescriptor()) {
|
||||
return nil, preg.NotFound
|
||||
}
|
||||
return xt, nil
|
||||
return true
|
||||
}
|
||||
|
||||
// SizeField returns the size of a MessageSet item field containing an extension
|
||||
|
98
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
generated
vendored
98
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
generated
vendored
@ -11,10 +11,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
defval "google.golang.org/protobuf/internal/encoding/defval"
|
||||
fdesc "google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/encoding/defval"
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
var byteType = reflect.TypeOf(byte(0))
|
||||
@ -29,9 +29,9 @@ var byteType = reflect.TypeOf(byte(0))
|
||||
// This does not populate the Enum or Message (except for weak message).
|
||||
//
|
||||
// This function is a best effort attempt; parsing errors are ignored.
|
||||
func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) pref.FieldDescriptor {
|
||||
f := new(fdesc.Field)
|
||||
f.L0.ParentFile = fdesc.SurrogateProto2
|
||||
func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor {
|
||||
f := new(filedesc.Field)
|
||||
f.L0.ParentFile = filedesc.SurrogateProto2
|
||||
for len(tag) > 0 {
|
||||
i := strings.IndexByte(tag, ',')
|
||||
if i < 0 {
|
||||
@ -39,95 +39,95 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
||||
}
|
||||
switch s := tag[:i]; {
|
||||
case strings.HasPrefix(s, "name="):
|
||||
f.L0.FullName = pref.FullName(s[len("name="):])
|
||||
f.L0.FullName = protoreflect.FullName(s[len("name="):])
|
||||
case strings.Trim(s, "0123456789") == "":
|
||||
n, _ := strconv.ParseUint(s, 10, 32)
|
||||
f.L1.Number = pref.FieldNumber(n)
|
||||
f.L1.Number = protoreflect.FieldNumber(n)
|
||||
case s == "opt":
|
||||
f.L1.Cardinality = pref.Optional
|
||||
f.L1.Cardinality = protoreflect.Optional
|
||||
case s == "req":
|
||||
f.L1.Cardinality = pref.Required
|
||||
f.L1.Cardinality = protoreflect.Required
|
||||
case s == "rep":
|
||||
f.L1.Cardinality = pref.Repeated
|
||||
f.L1.Cardinality = protoreflect.Repeated
|
||||
case s == "varint":
|
||||
switch goType.Kind() {
|
||||
case reflect.Bool:
|
||||
f.L1.Kind = pref.BoolKind
|
||||
f.L1.Kind = protoreflect.BoolKind
|
||||
case reflect.Int32:
|
||||
f.L1.Kind = pref.Int32Kind
|
||||
f.L1.Kind = protoreflect.Int32Kind
|
||||
case reflect.Int64:
|
||||
f.L1.Kind = pref.Int64Kind
|
||||
f.L1.Kind = protoreflect.Int64Kind
|
||||
case reflect.Uint32:
|
||||
f.L1.Kind = pref.Uint32Kind
|
||||
f.L1.Kind = protoreflect.Uint32Kind
|
||||
case reflect.Uint64:
|
||||
f.L1.Kind = pref.Uint64Kind
|
||||
f.L1.Kind = protoreflect.Uint64Kind
|
||||
}
|
||||
case s == "zigzag32":
|
||||
if goType.Kind() == reflect.Int32 {
|
||||
f.L1.Kind = pref.Sint32Kind
|
||||
f.L1.Kind = protoreflect.Sint32Kind
|
||||
}
|
||||
case s == "zigzag64":
|
||||
if goType.Kind() == reflect.Int64 {
|
||||
f.L1.Kind = pref.Sint64Kind
|
||||
f.L1.Kind = protoreflect.Sint64Kind
|
||||
}
|
||||
case s == "fixed32":
|
||||
switch goType.Kind() {
|
||||
case reflect.Int32:
|
||||
f.L1.Kind = pref.Sfixed32Kind
|
||||
f.L1.Kind = protoreflect.Sfixed32Kind
|
||||
case reflect.Uint32:
|
||||
f.L1.Kind = pref.Fixed32Kind
|
||||
f.L1.Kind = protoreflect.Fixed32Kind
|
||||
case reflect.Float32:
|
||||
f.L1.Kind = pref.FloatKind
|
||||
f.L1.Kind = protoreflect.FloatKind
|
||||
}
|
||||
case s == "fixed64":
|
||||
switch goType.Kind() {
|
||||
case reflect.Int64:
|
||||
f.L1.Kind = pref.Sfixed64Kind
|
||||
f.L1.Kind = protoreflect.Sfixed64Kind
|
||||
case reflect.Uint64:
|
||||
f.L1.Kind = pref.Fixed64Kind
|
||||
f.L1.Kind = protoreflect.Fixed64Kind
|
||||
case reflect.Float64:
|
||||
f.L1.Kind = pref.DoubleKind
|
||||
f.L1.Kind = protoreflect.DoubleKind
|
||||
}
|
||||
case s == "bytes":
|
||||
switch {
|
||||
case goType.Kind() == reflect.String:
|
||||
f.L1.Kind = pref.StringKind
|
||||
f.L1.Kind = protoreflect.StringKind
|
||||
case goType.Kind() == reflect.Slice && goType.Elem() == byteType:
|
||||
f.L1.Kind = pref.BytesKind
|
||||
f.L1.Kind = protoreflect.BytesKind
|
||||
default:
|
||||
f.L1.Kind = pref.MessageKind
|
||||
f.L1.Kind = protoreflect.MessageKind
|
||||
}
|
||||
case s == "group":
|
||||
f.L1.Kind = pref.GroupKind
|
||||
f.L1.Kind = protoreflect.GroupKind
|
||||
case strings.HasPrefix(s, "enum="):
|
||||
f.L1.Kind = pref.EnumKind
|
||||
f.L1.Kind = protoreflect.EnumKind
|
||||
case strings.HasPrefix(s, "json="):
|
||||
jsonName := s[len("json="):]
|
||||
if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {
|
||||
f.L1.JSONName.Init(jsonName)
|
||||
f.L1.StringName.InitJSON(jsonName)
|
||||
}
|
||||
case s == "packed":
|
||||
f.L1.HasPacked = true
|
||||
f.L1.IsPacked = true
|
||||
case strings.HasPrefix(s, "weak="):
|
||||
f.L1.IsWeak = true
|
||||
f.L1.Message = fdesc.PlaceholderMessage(pref.FullName(s[len("weak="):]))
|
||||
f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):]))
|
||||
case strings.HasPrefix(s, "def="):
|
||||
// The default tag is special in that everything afterwards is the
|
||||
// default regardless of the presence of commas.
|
||||
s, i = tag[len("def="):], len(tag)
|
||||
v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)
|
||||
f.L1.Default = fdesc.DefaultValue(v, ev)
|
||||
f.L1.Default = filedesc.DefaultValue(v, ev)
|
||||
case s == "proto3":
|
||||
f.L0.ParentFile = fdesc.SurrogateProto3
|
||||
f.L0.ParentFile = filedesc.SurrogateProto3
|
||||
}
|
||||
tag = strings.TrimPrefix(tag[i:], ",")
|
||||
}
|
||||
|
||||
// The generator uses the group message name instead of the field name.
|
||||
// We obtain the real field name by lowercasing the group name.
|
||||
if f.L1.Kind == pref.GroupKind {
|
||||
f.L0.FullName = pref.FullName(strings.ToLower(string(f.L0.FullName)))
|
||||
if f.L1.Kind == protoreflect.GroupKind {
|
||||
f.L0.FullName = protoreflect.FullName(strings.ToLower(string(f.L0.FullName)))
|
||||
}
|
||||
return f
|
||||
}
|
||||
@ -140,38 +140,38 @@ func Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) p
|
||||
// Depending on the context on how Marshal is called, there are different ways
|
||||
// through which that information is determined. As such it is the caller's
|
||||
// responsibility to provide a function to obtain that information.
|
||||
func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
||||
func Marshal(fd protoreflect.FieldDescriptor, enumName string) string {
|
||||
var tag []string
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind, pref.EnumKind, pref.Int32Kind, pref.Uint32Kind, pref.Int64Kind, pref.Uint64Kind:
|
||||
case protoreflect.BoolKind, protoreflect.EnumKind, protoreflect.Int32Kind, protoreflect.Uint32Kind, protoreflect.Int64Kind, protoreflect.Uint64Kind:
|
||||
tag = append(tag, "varint")
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
tag = append(tag, "zigzag32")
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
tag = append(tag, "zigzag64")
|
||||
case pref.Sfixed32Kind, pref.Fixed32Kind, pref.FloatKind:
|
||||
case protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind, protoreflect.FloatKind:
|
||||
tag = append(tag, "fixed32")
|
||||
case pref.Sfixed64Kind, pref.Fixed64Kind, pref.DoubleKind:
|
||||
case protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind, protoreflect.DoubleKind:
|
||||
tag = append(tag, "fixed64")
|
||||
case pref.StringKind, pref.BytesKind, pref.MessageKind:
|
||||
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind:
|
||||
tag = append(tag, "bytes")
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
tag = append(tag, "group")
|
||||
}
|
||||
tag = append(tag, strconv.Itoa(int(fd.Number())))
|
||||
switch fd.Cardinality() {
|
||||
case pref.Optional:
|
||||
case protoreflect.Optional:
|
||||
tag = append(tag, "opt")
|
||||
case pref.Required:
|
||||
case protoreflect.Required:
|
||||
tag = append(tag, "req")
|
||||
case pref.Repeated:
|
||||
case protoreflect.Repeated:
|
||||
tag = append(tag, "rep")
|
||||
}
|
||||
if fd.IsPacked() {
|
||||
tag = append(tag, "packed")
|
||||
}
|
||||
name := string(fd.Name())
|
||||
if fd.Kind() == pref.GroupKind {
|
||||
if fd.Kind() == protoreflect.GroupKind {
|
||||
// The name of the FieldDescriptor for a group field is
|
||||
// lowercased. To find the original capitalization, we
|
||||
// look in the field's MessageType.
|
||||
@ -189,10 +189,10 @@ func Marshal(fd pref.FieldDescriptor, enumName string) string {
|
||||
// The previous implementation does not tag extension fields as proto3,
|
||||
// even when the field is defined in a proto3 file. Match that behavior
|
||||
// for consistency.
|
||||
if fd.Syntax() == pref.Proto3 && !fd.IsExtension() {
|
||||
if fd.Syntax() == protoreflect.Proto3 && !fd.IsExtension() {
|
||||
tag = append(tag, "proto3")
|
||||
}
|
||||
if fd.Kind() == pref.EnumKind && enumName != "" {
|
||||
if fd.Kind() == protoreflect.EnumKind && enumName != "" {
|
||||
tag = append(tag, "enum="+enumName)
|
||||
}
|
||||
if fd.ContainingOneof() != nil {
|
||||
|
32
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
generated
vendored
32
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
generated
vendored
@ -8,7 +8,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"unicode/utf8"
|
||||
|
||||
@ -381,7 +380,7 @@ func (d *Decoder) currentOpenKind() (Kind, byte) {
|
||||
case '[':
|
||||
return ListOpen, ']'
|
||||
}
|
||||
panic(fmt.Sprintf("Decoder: openStack contains invalid byte %s", string(openCh)))
|
||||
panic(fmt.Sprintf("Decoder: openStack contains invalid byte %c", openCh))
|
||||
}
|
||||
|
||||
func (d *Decoder) pushOpenStack(ch byte) {
|
||||
@ -421,7 +420,7 @@ func (d *Decoder) parseFieldName() (tok Token, err error) {
|
||||
return Token{}, d.newSyntaxError("invalid field number: %s", d.in[:num.size])
|
||||
}
|
||||
|
||||
return Token{}, d.newSyntaxError("invalid field name: %s", errRegexp.Find(d.in))
|
||||
return Token{}, d.newSyntaxError("invalid field name: %s", errId(d.in))
|
||||
}
|
||||
|
||||
// parseTypeName parses Any type URL or extension field name. The name is
|
||||
@ -571,7 +570,7 @@ func (d *Decoder) parseScalar() (Token, error) {
|
||||
return tok, nil
|
||||
}
|
||||
|
||||
return Token{}, d.newSyntaxError("invalid scalar value: %s", errRegexp.Find(d.in))
|
||||
return Token{}, d.newSyntaxError("invalid scalar value: %s", errId(d.in))
|
||||
}
|
||||
|
||||
// parseLiteralValue parses a literal value. A literal value is used for
|
||||
@ -653,8 +652,29 @@ func consume(b []byte, n int) []byte {
|
||||
return b
|
||||
}
|
||||
|
||||
// Any sequence that looks like a non-delimiter (for error reporting).
|
||||
var errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9\/]+|.)`)
|
||||
// errId extracts a byte sequence that looks like an invalid ID
|
||||
// (for the purposes of error reporting).
|
||||
func errId(seq []byte) []byte {
|
||||
const maxLen = 32
|
||||
for i := 0; i < len(seq); {
|
||||
if i > maxLen {
|
||||
return append(seq[:i:i], "…"...)
|
||||
}
|
||||
r, size := utf8.DecodeRune(seq[i:])
|
||||
if r > utf8.RuneSelf || (r != '/' && isDelim(byte(r))) {
|
||||
if i == 0 {
|
||||
// Either the first byte is invalid UTF-8 or a
|
||||
// delimiter, or the first rune is non-ASCII.
|
||||
// Return it as-is.
|
||||
i = size
|
||||
}
|
||||
return seq[:i:i]
|
||||
}
|
||||
i += size
|
||||
}
|
||||
// No delimiter found.
|
||||
return seq
|
||||
}
|
||||
|
||||
// isDelim returns true if given byte is a delimiter character.
|
||||
func isDelim(c byte) bool {
|
||||
|
@ -50,8 +50,10 @@ type number struct {
|
||||
|
||||
// parseNumber constructs a number object from given input. It allows for the
|
||||
// following patterns:
|
||||
// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
|
||||
// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
|
||||
//
|
||||
// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
|
||||
// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
|
||||
//
|
||||
// It also returns the number of parsed bytes for the given number, 0 if it is
|
||||
// not a number.
|
||||
func parseNumber(input []byte) number {
|
||||
|
4
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
generated
vendored
4
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
generated
vendored
@ -24,6 +24,6 @@
|
||||
// the Go implementation should as well.
|
||||
//
|
||||
// The text format is almost a superset of JSON except:
|
||||
// * message keys are not quoted strings, but identifiers
|
||||
// * the top-level value must be a message without the delimiters
|
||||
// - message keys are not quoted strings, but identifiers
|
||||
// - the top-level value must be a message without the delimiters
|
||||
package text
|
||||
|
13
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
generated
vendored
13
actions/retest/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
generated
vendored
@ -32,7 +32,6 @@ type Encoder struct {
|
||||
encoderState
|
||||
|
||||
indent string
|
||||
newline string // set to "\n" if len(indent) > 0
|
||||
delims [2]byte
|
||||
outputASCII bool
|
||||
}
|
||||
@ -61,7 +60,6 @@ func NewEncoder(indent string, delims [2]byte, outputASCII bool) (*Encoder, erro
|
||||
return nil, errors.New("indent may only be composed of space and tab characters")
|
||||
}
|
||||
e.indent = indent
|
||||
e.newline = "\n"
|
||||
}
|
||||
switch delims {
|
||||
case [2]byte{0, 0}:
|
||||
@ -126,7 +124,7 @@ func appendString(out []byte, in string, outputASCII bool) []byte {
|
||||
// are used to represent both the proto string and bytes type.
|
||||
r = rune(in[0])
|
||||
fallthrough
|
||||
case r < ' ' || r == '"' || r == '\\':
|
||||
case r < ' ' || r == '"' || r == '\\' || r == 0x7f:
|
||||
out = append(out, '\\')
|
||||
switch r {
|
||||
case '"', '\\':
|
||||
@ -143,7 +141,7 @@ func appendString(out []byte, in string, outputASCII bool) []byte {
|
||||
out = strconv.AppendUint(out, uint64(r), 16)
|
||||
}
|
||||
in = in[n:]
|
||||
case outputASCII && r >= utf8.RuneSelf:
|
||||
case r >= utf8.RuneSelf && (outputASCII || r <= 0x009f):
|
||||
out = append(out, '\\')
|
||||
if r <= math.MaxUint16 {
|
||||
out = append(out, 'u')
|
||||
@ -168,7 +166,7 @@ func appendString(out []byte, in string, outputASCII bool) []byte {
|
||||
// escaping. If no characters need escaping, this returns the input length.
|
||||
func indexNeedEscapeInString(s string) int {
|
||||
for i := 0; i < len(s); i++ {
|
||||
if c := s[i]; c < ' ' || c == '"' || c == '\'' || c == '\\' || c >= utf8.RuneSelf {
|
||||
if c := s[i]; c < ' ' || c == '"' || c == '\'' || c == '\\' || c >= 0x7f {
|
||||
return i
|
||||
}
|
||||
}
|
||||
@ -265,3 +263,8 @@ func (e *Encoder) Snapshot() encoderState {
|
||||
func (e *Encoder) Reset(es encoderState) {
|
||||
e.encoderState = es
|
||||
}
|
||||
|
||||
// AppendString appends the escaped form of the input string to b.
|
||||
func AppendString(b []byte, s string) []byte {
|
||||
return appendString(b, s, false)
|
||||
}
|
||||
|
1
actions/retest/vendor/google.golang.org/protobuf/internal/errors/is_go112.go
generated
vendored
1
actions/retest/vendor/google.golang.org/protobuf/internal/errors/is_go112.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !go1.13
|
||||
// +build !go1.13
|
||||
|
||||
package errors
|
||||
|
1
actions/retest/vendor/google.golang.org/protobuf/internal/errors/is_go113.go
generated
vendored
1
actions/retest/vendor/google.golang.org/protobuf/internal/errors/is_go113.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.13
|
||||
// +build go1.13
|
||||
|
||||
package errors
|
||||
|
40
actions/retest/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go
generated
vendored
40
actions/retest/vendor/google.golang.org/protobuf/internal/fieldsort/fieldsort.go
generated
vendored
@ -1,40 +0,0 @@
|
||||
// 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 fieldsort defines an ordering of fields.
|
||||
//
|
||||
// The ordering defined by this package matches the historic behavior of the proto
|
||||
// package, placing extensions first and oneofs last.
|
||||
//
|
||||
// There is no guarantee about stability of the wire encoding, and users should not
|
||||
// depend on the order defined in this package as it is subject to change without
|
||||
// notice.
|
||||
package fieldsort
|
||||
|
||||
import (
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// Less returns true if field a comes before field j in ordered wire marshal output.
|
||||
func Less(a, b protoreflect.FieldDescriptor) bool {
|
||||
ea := a.IsExtension()
|
||||
eb := b.IsExtension()
|
||||
oa := a.ContainingOneof()
|
||||
ob := b.ContainingOneof()
|
||||
switch {
|
||||
case ea != eb:
|
||||
return ea
|
||||
case oa != nil && ob != nil:
|
||||
if oa == ob {
|
||||
return a.Number() < b.Number()
|
||||
}
|
||||
return oa.Index() < ob.Index()
|
||||
case oa != nil && !oa.IsSynthetic():
|
||||
return false
|
||||
case ob != nil && !ob.IsSynthetic():
|
||||
return true
|
||||
default:
|
||||
return a.Number() < b.Number()
|
||||
}
|
||||
}
|
22
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/build.go
generated
vendored
22
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/build.go
generated
vendored
@ -3,14 +3,16 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package filedesc provides functionality for constructing descriptors.
|
||||
//
|
||||
// The types in this package implement interfaces in the protoreflect package
|
||||
// related to protobuf descripriptors.
|
||||
package filedesc
|
||||
|
||||
import (
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
// Builder construct a protoreflect.FileDescriptor from the raw descriptor.
|
||||
@ -35,7 +37,7 @@ type Builder struct {
|
||||
// TypeResolver resolves extension field types for descriptor options.
|
||||
// If nil, it uses protoregistry.GlobalTypes.
|
||||
TypeResolver interface {
|
||||
preg.ExtensionTypeResolver
|
||||
protoregistry.ExtensionTypeResolver
|
||||
}
|
||||
|
||||
// FileRegistry is use to lookup file, enum, and message dependencies.
|
||||
@ -43,8 +45,8 @@ type Builder struct {
|
||||
// If nil, it uses protoregistry.GlobalFiles.
|
||||
FileRegistry interface {
|
||||
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||
FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
|
||||
RegisterFile(pref.FileDescriptor) error
|
||||
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||
RegisterFile(protoreflect.FileDescriptor) error
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,8 +54,8 @@ type Builder struct {
|
||||
// If so, it permits looking up an enum or message dependency based on the
|
||||
// sub-list and element index into filetype.Builder.DependencyIndexes.
|
||||
type resolverByIndex interface {
|
||||
FindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor
|
||||
FindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor
|
||||
FindEnumByIndex(int32, int32, []Enum, []Message) protoreflect.EnumDescriptor
|
||||
FindMessageByIndex(int32, int32, []Enum, []Message) protoreflect.MessageDescriptor
|
||||
}
|
||||
|
||||
// Indexes of each sub-list in filetype.Builder.DependencyIndexes.
|
||||
@ -67,7 +69,7 @@ const (
|
||||
|
||||
// Out is the output of the Builder.
|
||||
type Out struct {
|
||||
File pref.FileDescriptor
|
||||
File protoreflect.FileDescriptor
|
||||
|
||||
// Enums is all enum descriptors in "flattened ordering".
|
||||
Enums []Enum
|
||||
@ -94,10 +96,10 @@ func (db Builder) Build() (out Out) {
|
||||
|
||||
// Initialize resolvers and registries if unpopulated.
|
||||
if db.TypeResolver == nil {
|
||||
db.TypeResolver = preg.GlobalTypes
|
||||
db.TypeResolver = protoregistry.GlobalTypes
|
||||
}
|
||||
if db.FileRegistry == nil {
|
||||
db.FileRegistry = preg.GlobalFiles
|
||||
db.FileRegistry = protoregistry.GlobalFiles
|
||||
}
|
||||
|
||||
fd := newRawFile(db)
|
||||
|
435
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
435
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
generated
vendored
@ -13,10 +13,11 @@ import (
|
||||
"google.golang.org/protobuf/internal/descfmt"
|
||||
"google.golang.org/protobuf/internal/descopts"
|
||||
"google.golang.org/protobuf/internal/encoding/defval"
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
@ -42,9 +43,9 @@ type (
|
||||
L2 *FileL2
|
||||
}
|
||||
FileL1 struct {
|
||||
Syntax pref.Syntax
|
||||
Syntax protoreflect.Syntax
|
||||
Path string
|
||||
Package pref.FullName
|
||||
Package protoreflect.FullName
|
||||
|
||||
Enums Enums
|
||||
Messages Messages
|
||||
@ -52,36 +53,36 @@ type (
|
||||
Services Services
|
||||
}
|
||||
FileL2 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Imports FileImports
|
||||
Locations SourceLocations
|
||||
}
|
||||
)
|
||||
|
||||
func (fd *File) ParentFile() pref.FileDescriptor { return fd }
|
||||
func (fd *File) Parent() pref.Descriptor { return nil }
|
||||
func (fd *File) Index() int { return 0 }
|
||||
func (fd *File) Syntax() pref.Syntax { return fd.L1.Syntax }
|
||||
func (fd *File) Name() pref.Name { return fd.L1.Package.Name() }
|
||||
func (fd *File) FullName() pref.FullName { return fd.L1.Package }
|
||||
func (fd *File) IsPlaceholder() bool { return false }
|
||||
func (fd *File) Options() pref.ProtoMessage {
|
||||
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 }
|
||||
func (fd *File) Options() protoreflect.ProtoMessage {
|
||||
if f := fd.lazyInit().Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.File
|
||||
}
|
||||
func (fd *File) Path() string { return fd.L1.Path }
|
||||
func (fd *File) Package() pref.FullName { return fd.L1.Package }
|
||||
func (fd *File) Imports() pref.FileImports { return &fd.lazyInit().Imports }
|
||||
func (fd *File) Enums() pref.EnumDescriptors { return &fd.L1.Enums }
|
||||
func (fd *File) Messages() pref.MessageDescriptors { return &fd.L1.Messages }
|
||||
func (fd *File) Extensions() pref.ExtensionDescriptors { return &fd.L1.Extensions }
|
||||
func (fd *File) Services() pref.ServiceDescriptors { return &fd.L1.Services }
|
||||
func (fd *File) SourceLocations() pref.SourceLocations { return &fd.lazyInit().Locations }
|
||||
func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||
func (fd *File) ProtoType(pref.FileDescriptor) {}
|
||||
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (fd *File) Path() string { return fd.L1.Path }
|
||||
func (fd *File) Package() protoreflect.FullName { return fd.L1.Package }
|
||||
func (fd *File) Imports() protoreflect.FileImports { return &fd.lazyInit().Imports }
|
||||
func (fd *File) Enums() protoreflect.EnumDescriptors { return &fd.L1.Enums }
|
||||
func (fd *File) Messages() protoreflect.MessageDescriptors { return &fd.L1.Messages }
|
||||
func (fd *File) Extensions() protoreflect.ExtensionDescriptors { return &fd.L1.Extensions }
|
||||
func (fd *File) Services() protoreflect.ServiceDescriptors { return &fd.L1.Services }
|
||||
func (fd *File) SourceLocations() protoreflect.SourceLocations { return &fd.lazyInit().Locations }
|
||||
func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||
func (fd *File) ProtoType(protoreflect.FileDescriptor) {}
|
||||
func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
func (fd *File) lazyInit() *FileL2 {
|
||||
if atomic.LoadUint32(&fd.once) == 0 {
|
||||
@ -99,15 +100,6 @@ func (fd *File) lazyInitOnce() {
|
||||
fd.mu.Unlock()
|
||||
}
|
||||
|
||||
// ProtoLegacyRawDesc is a pseudo-internal API for allowing the v1 code
|
||||
// to be able to retrieve the raw descriptor.
|
||||
//
|
||||
// WARNING: This method is exempt from the compatibility promise and may be
|
||||
// removed in the future without warning.
|
||||
func (fd *File) ProtoLegacyRawDesc() []byte {
|
||||
return fd.builder.RawDescriptor
|
||||
}
|
||||
|
||||
// GoPackagePath is a pseudo-internal API for determining the Go package path
|
||||
// that this file descriptor is declared in.
|
||||
//
|
||||
@ -127,7 +119,7 @@ type (
|
||||
eagerValues bool // controls whether EnumL2.Values is already populated
|
||||
}
|
||||
EnumL2 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Values EnumValues
|
||||
ReservedNames Names
|
||||
ReservedRanges EnumRanges
|
||||
@ -138,41 +130,41 @@ type (
|
||||
L1 EnumValueL1
|
||||
}
|
||||
EnumValueL1 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Number pref.EnumNumber
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Number protoreflect.EnumNumber
|
||||
}
|
||||
)
|
||||
|
||||
func (ed *Enum) Options() pref.ProtoMessage {
|
||||
func (ed *Enum) Options() protoreflect.ProtoMessage {
|
||||
if f := ed.lazyInit().Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Enum
|
||||
}
|
||||
func (ed *Enum) Values() pref.EnumValueDescriptors {
|
||||
func (ed *Enum) Values() protoreflect.EnumValueDescriptors {
|
||||
if ed.L1.eagerValues {
|
||||
return &ed.L2.Values
|
||||
}
|
||||
return &ed.lazyInit().Values
|
||||
}
|
||||
func (ed *Enum) ReservedNames() pref.Names { return &ed.lazyInit().ReservedNames }
|
||||
func (ed *Enum) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
||||
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||
func (ed *Enum) ProtoType(pref.EnumDescriptor) {}
|
||||
func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit().ReservedNames }
|
||||
func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges }
|
||||
func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||
func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {}
|
||||
func (ed *Enum) lazyInit() *EnumL2 {
|
||||
ed.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||
return ed.L2
|
||||
}
|
||||
|
||||
func (ed *EnumValue) Options() pref.ProtoMessage {
|
||||
func (ed *EnumValue) Options() protoreflect.ProtoMessage {
|
||||
if f := ed.L1.Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.EnumValue
|
||||
}
|
||||
func (ed *EnumValue) Number() pref.EnumNumber { return ed.L1.Number }
|
||||
func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||
func (ed *EnumValue) ProtoType(pref.EnumValueDescriptor) {}
|
||||
func (ed *EnumValue) Number() protoreflect.EnumNumber { return ed.L1.Number }
|
||||
func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
|
||||
func (ed *EnumValue) ProtoType(protoreflect.EnumValueDescriptor) {}
|
||||
|
||||
type (
|
||||
Message struct {
|
||||
@ -188,14 +180,14 @@ type (
|
||||
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
||||
}
|
||||
MessageL2 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Fields Fields
|
||||
Oneofs Oneofs
|
||||
ReservedNames Names
|
||||
ReservedRanges FieldRanges
|
||||
RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality
|
||||
ExtensionRanges FieldRanges
|
||||
ExtensionRangeOptions []func() pref.ProtoMessage // must be same length as ExtensionRanges
|
||||
ExtensionRangeOptions []func() protoreflect.ProtoMessage // must be same length as ExtensionRanges
|
||||
}
|
||||
|
||||
Field struct {
|
||||
@ -203,11 +195,11 @@ type (
|
||||
L1 FieldL1
|
||||
}
|
||||
FieldL1 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Number pref.FieldNumber
|
||||
Cardinality pref.Cardinality // must be consistent with Message.RequiredNumbers
|
||||
Kind pref.Kind
|
||||
JSONName jsonName
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Number protoreflect.FieldNumber
|
||||
Cardinality protoreflect.Cardinality // must be consistent with Message.RequiredNumbers
|
||||
Kind protoreflect.Kind
|
||||
StringName stringName
|
||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||
IsWeak bool // promoted from google.protobuf.FieldOptions
|
||||
HasPacked bool // promoted from google.protobuf.FieldOptions
|
||||
@ -215,9 +207,9 @@ type (
|
||||
HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
||||
EnforceUTF8 bool // promoted from google.protobuf.FieldOptions
|
||||
Default defaultValue
|
||||
ContainingOneof pref.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
||||
Enum pref.EnumDescriptor
|
||||
Message pref.MessageDescriptor
|
||||
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
||||
Enum protoreflect.EnumDescriptor
|
||||
Message protoreflect.MessageDescriptor
|
||||
}
|
||||
|
||||
Oneof struct {
|
||||
@ -225,35 +217,35 @@ type (
|
||||
L1 OneofL1
|
||||
}
|
||||
OneofL1 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
||||
}
|
||||
)
|
||||
|
||||
func (md *Message) Options() pref.ProtoMessage {
|
||||
func (md *Message) Options() protoreflect.ProtoMessage {
|
||||
if f := md.lazyInit().Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Message
|
||||
}
|
||||
func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
|
||||
func (md *Message) Fields() pref.FieldDescriptors { return &md.lazyInit().Fields }
|
||||
func (md *Message) Oneofs() pref.OneofDescriptors { return &md.lazyInit().Oneofs }
|
||||
func (md *Message) ReservedNames() pref.Names { return &md.lazyInit().ReservedNames }
|
||||
func (md *Message) ReservedRanges() pref.FieldRanges { return &md.lazyInit().ReservedRanges }
|
||||
func (md *Message) RequiredNumbers() pref.FieldNumbers { return &md.lazyInit().RequiredNumbers }
|
||||
func (md *Message) ExtensionRanges() pref.FieldRanges { return &md.lazyInit().ExtensionRanges }
|
||||
func (md *Message) ExtensionRangeOptions(i int) pref.ProtoMessage {
|
||||
func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
|
||||
func (md *Message) Fields() protoreflect.FieldDescriptors { return &md.lazyInit().Fields }
|
||||
func (md *Message) Oneofs() protoreflect.OneofDescriptors { return &md.lazyInit().Oneofs }
|
||||
func (md *Message) ReservedNames() protoreflect.Names { return &md.lazyInit().ReservedNames }
|
||||
func (md *Message) ReservedRanges() protoreflect.FieldRanges { return &md.lazyInit().ReservedRanges }
|
||||
func (md *Message) RequiredNumbers() protoreflect.FieldNumbers { return &md.lazyInit().RequiredNumbers }
|
||||
func (md *Message) ExtensionRanges() protoreflect.FieldRanges { return &md.lazyInit().ExtensionRanges }
|
||||
func (md *Message) ExtensionRangeOptions(i int) protoreflect.ProtoMessage {
|
||||
if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.ExtensionRange
|
||||
}
|
||||
func (md *Message) Enums() pref.EnumDescriptors { return &md.L1.Enums }
|
||||
func (md *Message) Messages() pref.MessageDescriptors { return &md.L1.Messages }
|
||||
func (md *Message) Extensions() pref.ExtensionDescriptors { return &md.L1.Extensions }
|
||||
func (md *Message) ProtoType(pref.MessageDescriptor) {}
|
||||
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||
func (md *Message) Enums() protoreflect.EnumDescriptors { return &md.L1.Enums }
|
||||
func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L1.Messages }
|
||||
func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions }
|
||||
func (md *Message) ProtoType(protoreflect.MessageDescriptor) {}
|
||||
func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||
func (md *Message) lazyInit() *MessageL2 {
|
||||
md.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||
return md.L2
|
||||
@ -268,27 +260,28 @@ func (md *Message) IsMessageSet() bool {
|
||||
return md.L1.IsMessageSet
|
||||
}
|
||||
|
||||
func (fd *Field) Options() pref.ProtoMessage {
|
||||
func (fd *Field) Options() protoreflect.ProtoMessage {
|
||||
if f := fd.L1.Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Field
|
||||
}
|
||||
func (fd *Field) Number() pref.FieldNumber { return fd.L1.Number }
|
||||
func (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality }
|
||||
func (fd *Field) Kind() pref.Kind { return fd.L1.Kind }
|
||||
func (fd *Field) HasJSONName() bool { return fd.L1.JSONName.has }
|
||||
func (fd *Field) JSONName() string { return fd.L1.JSONName.get(fd) }
|
||||
func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number }
|
||||
func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality }
|
||||
func (fd *Field) Kind() protoreflect.Kind { return fd.L1.Kind }
|
||||
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
||||
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
||||
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
||||
func (fd *Field) HasPresence() bool {
|
||||
return fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
|
||||
return fd.L1.Cardinality != protoreflect.Repeated && (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
|
||||
}
|
||||
func (fd *Field) HasOptionalKeyword() bool {
|
||||
return (fd.L0.ParentFile.L1.Syntax == pref.Proto2 && fd.L1.Cardinality == pref.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
||||
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
||||
}
|
||||
func (fd *Field) IsPacked() bool {
|
||||
if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != pref.Proto2 && fd.L1.Cardinality == pref.Repeated {
|
||||
if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Repeated {
|
||||
switch fd.L1.Kind {
|
||||
case pref.StringKind, pref.BytesKind, pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
default:
|
||||
return true
|
||||
}
|
||||
@ -297,40 +290,40 @@ func (fd *Field) IsPacked() bool {
|
||||
}
|
||||
func (fd *Field) IsExtension() bool { return false }
|
||||
func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
|
||||
func (fd *Field) IsList() bool { return fd.Cardinality() == pref.Repeated && !fd.IsMap() }
|
||||
func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() }
|
||||
func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
|
||||
func (fd *Field) MapKey() pref.FieldDescriptor {
|
||||
func (fd *Field) MapKey() protoreflect.FieldDescriptor {
|
||||
if !fd.IsMap() {
|
||||
return nil
|
||||
}
|
||||
return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)
|
||||
}
|
||||
func (fd *Field) MapValue() pref.FieldDescriptor {
|
||||
func (fd *Field) MapValue() protoreflect.FieldDescriptor {
|
||||
if !fd.IsMap() {
|
||||
return nil
|
||||
}
|
||||
return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)
|
||||
}
|
||||
func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
|
||||
func (fd *Field) Default() pref.Value { return fd.L1.Default.get(fd) }
|
||||
func (fd *Field) DefaultEnumValue() pref.EnumValueDescriptor { return fd.L1.Default.enum }
|
||||
func (fd *Field) ContainingOneof() pref.OneofDescriptor { return fd.L1.ContainingOneof }
|
||||
func (fd *Field) ContainingMessage() pref.MessageDescriptor {
|
||||
return fd.L0.Parent.(pref.MessageDescriptor)
|
||||
func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
|
||||
func (fd *Field) Default() protoreflect.Value { return fd.L1.Default.get(fd) }
|
||||
func (fd *Field) DefaultEnumValue() protoreflect.EnumValueDescriptor { return fd.L1.Default.enum }
|
||||
func (fd *Field) ContainingOneof() protoreflect.OneofDescriptor { return fd.L1.ContainingOneof }
|
||||
func (fd *Field) ContainingMessage() protoreflect.MessageDescriptor {
|
||||
return fd.L0.Parent.(protoreflect.MessageDescriptor)
|
||||
}
|
||||
func (fd *Field) Enum() pref.EnumDescriptor {
|
||||
func (fd *Field) Enum() protoreflect.EnumDescriptor {
|
||||
return fd.L1.Enum
|
||||
}
|
||||
func (fd *Field) Message() pref.MessageDescriptor {
|
||||
func (fd *Field) Message() protoreflect.MessageDescriptor {
|
||||
if fd.L1.IsWeak {
|
||||
if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
|
||||
return d.(pref.MessageDescriptor)
|
||||
return d.(protoreflect.MessageDescriptor)
|
||||
}
|
||||
}
|
||||
return fd.L1.Message
|
||||
}
|
||||
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||
func (fd *Field) ProtoType(pref.FieldDescriptor) {}
|
||||
func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
|
||||
func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
|
||||
|
||||
// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8
|
||||
// validation for the string field. This exists for Google-internal use only
|
||||
@ -343,21 +336,21 @@ func (fd *Field) EnforceUTF8() bool {
|
||||
if fd.L1.HasEnforceUTF8 {
|
||||
return fd.L1.EnforceUTF8
|
||||
}
|
||||
return fd.L0.ParentFile.L1.Syntax == pref.Proto3
|
||||
return fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3
|
||||
}
|
||||
|
||||
func (od *Oneof) IsSynthetic() bool {
|
||||
return od.L0.ParentFile.L1.Syntax == pref.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
|
||||
return od.L0.ParentFile.L1.Syntax == protoreflect.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
|
||||
}
|
||||
func (od *Oneof) Options() pref.ProtoMessage {
|
||||
func (od *Oneof) Options() protoreflect.ProtoMessage {
|
||||
if f := od.L1.Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Oneof
|
||||
}
|
||||
func (od *Oneof) Fields() pref.FieldDescriptors { return &od.L1.Fields }
|
||||
func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
|
||||
func (od *Oneof) ProtoType(pref.OneofDescriptor) {}
|
||||
func (od *Oneof) Fields() protoreflect.FieldDescriptors { return &od.L1.Fields }
|
||||
func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
|
||||
func (od *Oneof) ProtoType(protoreflect.OneofDescriptor) {}
|
||||
|
||||
type (
|
||||
Extension struct {
|
||||
@ -366,54 +359,57 @@ type (
|
||||
L2 *ExtensionL2 // protected by fileDesc.once
|
||||
}
|
||||
ExtensionL1 struct {
|
||||
Number pref.FieldNumber
|
||||
Extendee pref.MessageDescriptor
|
||||
Cardinality pref.Cardinality
|
||||
Kind pref.Kind
|
||||
Number protoreflect.FieldNumber
|
||||
Extendee protoreflect.MessageDescriptor
|
||||
Cardinality protoreflect.Cardinality
|
||||
Kind protoreflect.Kind
|
||||
}
|
||||
ExtensionL2 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
JSONName jsonName
|
||||
Options func() protoreflect.ProtoMessage
|
||||
StringName stringName
|
||||
IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
|
||||
IsPacked bool // promoted from google.protobuf.FieldOptions
|
||||
Default defaultValue
|
||||
Enum pref.EnumDescriptor
|
||||
Message pref.MessageDescriptor
|
||||
Enum protoreflect.EnumDescriptor
|
||||
Message protoreflect.MessageDescriptor
|
||||
}
|
||||
)
|
||||
|
||||
func (xd *Extension) Options() pref.ProtoMessage {
|
||||
func (xd *Extension) Options() protoreflect.ProtoMessage {
|
||||
if f := xd.lazyInit().Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Field
|
||||
}
|
||||
func (xd *Extension) Number() pref.FieldNumber { return xd.L1.Number }
|
||||
func (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality }
|
||||
func (xd *Extension) Kind() pref.Kind { return xd.L1.Kind }
|
||||
func (xd *Extension) HasJSONName() bool { return xd.lazyInit().JSONName.has }
|
||||
func (xd *Extension) JSONName() string { return xd.lazyInit().JSONName.get(xd) }
|
||||
func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != pref.Repeated }
|
||||
func (xd *Extension) Number() protoreflect.FieldNumber { return xd.L1.Number }
|
||||
func (xd *Extension) Cardinality() protoreflect.Cardinality { return xd.L1.Cardinality }
|
||||
func (xd *Extension) Kind() protoreflect.Kind { return xd.L1.Kind }
|
||||
func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON }
|
||||
func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) }
|
||||
func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) }
|
||||
func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != protoreflect.Repeated }
|
||||
func (xd *Extension) HasOptionalKeyword() bool {
|
||||
return (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional
|
||||
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) IsExtension() bool { return true }
|
||||
func (xd *Extension) IsWeak() bool { return false }
|
||||
func (xd *Extension) IsList() bool { return xd.Cardinality() == pref.Repeated }
|
||||
func (xd *Extension) IsMap() bool { return false }
|
||||
func (xd *Extension) MapKey() pref.FieldDescriptor { return nil }
|
||||
func (xd *Extension) MapValue() pref.FieldDescriptor { return nil }
|
||||
func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
|
||||
func (xd *Extension) Default() pref.Value { return xd.lazyInit().Default.get(xd) }
|
||||
func (xd *Extension) DefaultEnumValue() pref.EnumValueDescriptor { return xd.lazyInit().Default.enum }
|
||||
func (xd *Extension) ContainingOneof() pref.OneofDescriptor { return nil }
|
||||
func (xd *Extension) ContainingMessage() pref.MessageDescriptor { return xd.L1.Extendee }
|
||||
func (xd *Extension) Enum() pref.EnumDescriptor { return xd.lazyInit().Enum }
|
||||
func (xd *Extension) Message() pref.MessageDescriptor { return xd.lazyInit().Message }
|
||||
func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
|
||||
func (xd *Extension) ProtoType(pref.FieldDescriptor) {}
|
||||
func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (xd *Extension) IsPacked() bool { return xd.lazyInit().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 }
|
||||
func (xd *Extension) IsMap() bool { return false }
|
||||
func (xd *Extension) MapKey() protoreflect.FieldDescriptor { return nil }
|
||||
func (xd *Extension) MapValue() protoreflect.FieldDescriptor { return nil }
|
||||
func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
|
||||
func (xd *Extension) Default() protoreflect.Value { return xd.lazyInit().Default.get(xd) }
|
||||
func (xd *Extension) DefaultEnumValue() protoreflect.EnumValueDescriptor {
|
||||
return xd.lazyInit().Default.enum
|
||||
}
|
||||
func (xd *Extension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
|
||||
func (xd *Extension) ContainingMessage() protoreflect.MessageDescriptor { return xd.L1.Extendee }
|
||||
func (xd *Extension) Enum() protoreflect.EnumDescriptor { return xd.lazyInit().Enum }
|
||||
func (xd *Extension) Message() protoreflect.MessageDescriptor { return xd.lazyInit().Message }
|
||||
func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
|
||||
func (xd *Extension) ProtoType(protoreflect.FieldDescriptor) {}
|
||||
func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (xd *Extension) lazyInit() *ExtensionL2 {
|
||||
xd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||
return xd.L2
|
||||
@ -427,7 +423,7 @@ type (
|
||||
}
|
||||
ServiceL1 struct{}
|
||||
ServiceL2 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Methods Methods
|
||||
}
|
||||
|
||||
@ -436,48 +432,48 @@ type (
|
||||
L1 MethodL1
|
||||
}
|
||||
MethodL1 struct {
|
||||
Options func() pref.ProtoMessage
|
||||
Input pref.MessageDescriptor
|
||||
Output pref.MessageDescriptor
|
||||
Options func() protoreflect.ProtoMessage
|
||||
Input protoreflect.MessageDescriptor
|
||||
Output protoreflect.MessageDescriptor
|
||||
IsStreamingClient bool
|
||||
IsStreamingServer bool
|
||||
}
|
||||
)
|
||||
|
||||
func (sd *Service) Options() pref.ProtoMessage {
|
||||
func (sd *Service) Options() protoreflect.ProtoMessage {
|
||||
if f := sd.lazyInit().Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Service
|
||||
}
|
||||
func (sd *Service) Methods() pref.MethodDescriptors { return &sd.lazyInit().Methods }
|
||||
func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
|
||||
func (sd *Service) ProtoType(pref.ServiceDescriptor) {}
|
||||
func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (sd *Service) Methods() protoreflect.MethodDescriptors { return &sd.lazyInit().Methods }
|
||||
func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
|
||||
func (sd *Service) ProtoType(protoreflect.ServiceDescriptor) {}
|
||||
func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (sd *Service) lazyInit() *ServiceL2 {
|
||||
sd.L0.ParentFile.lazyInit() // implicitly initializes L2
|
||||
return sd.L2
|
||||
}
|
||||
|
||||
func (md *Method) Options() pref.ProtoMessage {
|
||||
func (md *Method) Options() protoreflect.ProtoMessage {
|
||||
if f := md.L1.Options; f != nil {
|
||||
return f()
|
||||
}
|
||||
return descopts.Method
|
||||
}
|
||||
func (md *Method) Input() pref.MessageDescriptor { return md.L1.Input }
|
||||
func (md *Method) Output() pref.MessageDescriptor { return md.L1.Output }
|
||||
func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
|
||||
func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
|
||||
func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||
func (md *Method) ProtoType(pref.MethodDescriptor) {}
|
||||
func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (md *Method) Input() protoreflect.MessageDescriptor { return md.L1.Input }
|
||||
func (md *Method) Output() protoreflect.MessageDescriptor { return md.L1.Output }
|
||||
func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
|
||||
func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
|
||||
func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
|
||||
func (md *Method) ProtoType(protoreflect.MethodDescriptor) {}
|
||||
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: pref.Proto2}, L2: &FileL2{}}
|
||||
SurrogateProto3 = &File{L1: FileL1{Syntax: pref.Proto3}, L2: &FileL2{}}
|
||||
SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
|
||||
SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
|
||||
)
|
||||
|
||||
type (
|
||||
@ -485,49 +481,72 @@ type (
|
||||
L0 BaseL0
|
||||
}
|
||||
BaseL0 struct {
|
||||
FullName pref.FullName // must be populated
|
||||
ParentFile *File // must be populated
|
||||
Parent pref.Descriptor
|
||||
FullName protoreflect.FullName // must be populated
|
||||
ParentFile *File // must be populated
|
||||
Parent protoreflect.Descriptor
|
||||
Index int
|
||||
}
|
||||
)
|
||||
|
||||
func (d *Base) Name() pref.Name { return d.L0.FullName.Name() }
|
||||
func (d *Base) FullName() pref.FullName { return d.L0.FullName }
|
||||
func (d *Base) ParentFile() pref.FileDescriptor {
|
||||
func (d *Base) Name() protoreflect.Name { return d.L0.FullName.Name() }
|
||||
func (d *Base) FullName() protoreflect.FullName { return d.L0.FullName }
|
||||
func (d *Base) ParentFile() protoreflect.FileDescriptor {
|
||||
if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {
|
||||
return nil // surrogate files are not real parents
|
||||
}
|
||||
return d.L0.ParentFile
|
||||
}
|
||||
func (d *Base) Parent() pref.Descriptor { return d.L0.Parent }
|
||||
func (d *Base) Parent() protoreflect.Descriptor { return d.L0.Parent }
|
||||
func (d *Base) Index() int { return d.L0.Index }
|
||||
func (d *Base) Syntax() pref.Syntax { return d.L0.ParentFile.Syntax() }
|
||||
func (d *Base) Syntax() protoreflect.Syntax { return d.L0.ParentFile.Syntax() }
|
||||
func (d *Base) IsPlaceholder() bool { return false }
|
||||
func (d *Base) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
type jsonName struct {
|
||||
has bool
|
||||
once sync.Once
|
||||
name string
|
||||
type stringName struct {
|
||||
hasJSON bool
|
||||
once sync.Once
|
||||
nameJSON string
|
||||
nameText string
|
||||
}
|
||||
|
||||
// Init initializes the name. It is exported for use by other internal packages.
|
||||
func (js *jsonName) Init(s string) {
|
||||
js.has = true
|
||||
js.name = s
|
||||
// InitJSON initializes the name. It is exported for use by other internal packages.
|
||||
func (s *stringName) InitJSON(name string) {
|
||||
s.hasJSON = true
|
||||
s.nameJSON = name
|
||||
}
|
||||
|
||||
func (js *jsonName) get(fd pref.FieldDescriptor) string {
|
||||
if !js.has {
|
||||
js.once.Do(func() {
|
||||
js.name = strs.JSONCamelCase(string(fd.Name()))
|
||||
})
|
||||
}
|
||||
return js.name
|
||||
func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {
|
||||
s.once.Do(func() {
|
||||
if fd.IsExtension() {
|
||||
// For extensions, JSON and text are formatted the same way.
|
||||
var name string
|
||||
if messageset.IsMessageSetExtension(fd) {
|
||||
name = string("[" + fd.FullName().Parent() + "]")
|
||||
} else {
|
||||
name = string("[" + fd.FullName() + "]")
|
||||
}
|
||||
s.nameJSON = name
|
||||
s.nameText = name
|
||||
} else {
|
||||
// Format the JSON name.
|
||||
if !s.hasJSON {
|
||||
s.nameJSON = strs.JSONCamelCase(string(fd.Name()))
|
||||
}
|
||||
|
||||
// Format the text name.
|
||||
s.nameText = string(fd.Name())
|
||||
if fd.Kind() == protoreflect.GroupKind {
|
||||
s.nameText = string(fd.Message().Name())
|
||||
}
|
||||
}
|
||||
})
|
||||
return s
|
||||
}
|
||||
|
||||
func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {
|
||||
func (s *stringName) getJSON(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }
|
||||
func (s *stringName) getText(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameText }
|
||||
|
||||
func DefaultValue(v protoreflect.Value, ev protoreflect.EnumValueDescriptor) defaultValue {
|
||||
dv := defaultValue{has: v.IsValid(), val: v, enum: ev}
|
||||
if b, ok := v.Interface().([]byte); ok {
|
||||
// Store a copy of the default bytes, so that we can detect
|
||||
@ -537,9 +556,9 @@ func DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {
|
||||
return dv
|
||||
}
|
||||
|
||||
func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) defaultValue {
|
||||
var evs pref.EnumValueDescriptors
|
||||
if k == pref.EnumKind {
|
||||
func unmarshalDefault(b []byte, k protoreflect.Kind, pf *File, ed protoreflect.EnumDescriptor) defaultValue {
|
||||
var evs protoreflect.EnumValueDescriptors
|
||||
if k == protoreflect.EnumKind {
|
||||
// If the enum is declared within the same file, be careful not to
|
||||
// blindly call the Values method, lest we bind ourselves in a deadlock.
|
||||
if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {
|
||||
@ -550,9 +569,9 @@ func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) d
|
||||
|
||||
// If we are unable to resolve the enum dependency, use a placeholder
|
||||
// enum value since we will not be able to parse the default value.
|
||||
if ed.IsPlaceholder() && pref.Name(b).IsValid() {
|
||||
v := pref.ValueOfEnum(0)
|
||||
ev := PlaceholderEnumValue(ed.FullName().Parent().Append(pref.Name(b)))
|
||||
if ed.IsPlaceholder() && protoreflect.Name(b).IsValid() {
|
||||
v := protoreflect.ValueOfEnum(0)
|
||||
ev := PlaceholderEnumValue(ed.FullName().Parent().Append(protoreflect.Name(b)))
|
||||
return DefaultValue(v, ev)
|
||||
}
|
||||
}
|
||||
@ -566,41 +585,41 @@ func unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) d
|
||||
|
||||
type defaultValue struct {
|
||||
has bool
|
||||
val pref.Value
|
||||
enum pref.EnumValueDescriptor
|
||||
val protoreflect.Value
|
||||
enum protoreflect.EnumValueDescriptor
|
||||
bytes []byte
|
||||
}
|
||||
|
||||
func (dv *defaultValue) get(fd pref.FieldDescriptor) pref.Value {
|
||||
func (dv *defaultValue) get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
// Return the zero value as the default if unpopulated.
|
||||
if !dv.has {
|
||||
if fd.Cardinality() == pref.Repeated {
|
||||
return pref.Value{}
|
||||
if fd.Cardinality() == protoreflect.Repeated {
|
||||
return protoreflect.Value{}
|
||||
}
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
return pref.ValueOfBool(false)
|
||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
||||
return pref.ValueOfInt32(0)
|
||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
||||
return pref.ValueOfInt64(0)
|
||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
||||
return pref.ValueOfUint32(0)
|
||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
||||
return pref.ValueOfUint64(0)
|
||||
case pref.FloatKind:
|
||||
return pref.ValueOfFloat32(0)
|
||||
case pref.DoubleKind:
|
||||
return pref.ValueOfFloat64(0)
|
||||
case pref.StringKind:
|
||||
return pref.ValueOfString("")
|
||||
case pref.BytesKind:
|
||||
return pref.ValueOfBytes(nil)
|
||||
case pref.EnumKind:
|
||||
case protoreflect.BoolKind:
|
||||
return protoreflect.ValueOfBool(false)
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
return protoreflect.ValueOfInt32(0)
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
return protoreflect.ValueOfInt64(0)
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
return protoreflect.ValueOfUint32(0)
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
return protoreflect.ValueOfUint64(0)
|
||||
case protoreflect.FloatKind:
|
||||
return protoreflect.ValueOfFloat32(0)
|
||||
case protoreflect.DoubleKind:
|
||||
return protoreflect.ValueOfFloat64(0)
|
||||
case protoreflect.StringKind:
|
||||
return protoreflect.ValueOfString("")
|
||||
case protoreflect.BytesKind:
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
case protoreflect.EnumKind:
|
||||
if evs := fd.Enum().Values(); evs.Len() > 0 {
|
||||
return pref.ValueOfEnum(evs.Get(0).Number())
|
||||
return protoreflect.ValueOfEnum(evs.Get(0).Number())
|
||||
}
|
||||
return pref.ValueOfEnum(0)
|
||||
return protoreflect.ValueOfEnum(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
36
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
36
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// fileRaw is a data struct used when initializing a file descriptor from
|
||||
@ -95,7 +95,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||
sb := getBuilder()
|
||||
defer putBuilder(sb)
|
||||
|
||||
var prevField pref.FieldNumber
|
||||
var prevField protoreflect.FieldNumber
|
||||
var numEnums, numMessages, numExtensions, numServices int
|
||||
var posEnums, posMessages, posExtensions, posServices int
|
||||
b0 := b
|
||||
@ -110,16 +110,16 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||
case genid.FileDescriptorProto_Syntax_field_number:
|
||||
switch string(v) {
|
||||
case "proto2":
|
||||
fd.L1.Syntax = pref.Proto2
|
||||
fd.L1.Syntax = protoreflect.Proto2
|
||||
case "proto3":
|
||||
fd.L1.Syntax = pref.Proto3
|
||||
fd.L1.Syntax = protoreflect.Proto3
|
||||
default:
|
||||
panic("invalid syntax")
|
||||
}
|
||||
case genid.FileDescriptorProto_Name_field_number:
|
||||
fd.L1.Path = sb.MakeString(v)
|
||||
case genid.FileDescriptorProto_Package_field_number:
|
||||
fd.L1.Package = pref.FullName(sb.MakeString(v))
|
||||
fd.L1.Package = protoreflect.FullName(sb.MakeString(v))
|
||||
case genid.FileDescriptorProto_EnumType_field_number:
|
||||
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
||||
if numEnums > 0 {
|
||||
@ -163,7 +163,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||
|
||||
// If syntax is missing, it is assumed to be proto2.
|
||||
if fd.L1.Syntax == 0 {
|
||||
fd.L1.Syntax = pref.Proto2
|
||||
fd.L1.Syntax = protoreflect.Proto2
|
||||
}
|
||||
|
||||
// Must allocate all declarations before parsing each descriptor type
|
||||
@ -219,7 +219,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
ed.L0.ParentFile = pf
|
||||
ed.L0.Parent = pd
|
||||
ed.L0.Index = i
|
||||
@ -271,12 +271,12 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Desc
|
||||
}
|
||||
}
|
||||
|
||||
func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
md.L0.ParentFile = pf
|
||||
md.L0.Parent = pd
|
||||
md.L0.Index = i
|
||||
|
||||
var prevField pref.FieldNumber
|
||||
var prevField protoreflect.FieldNumber
|
||||
var numEnums, numMessages, numExtensions int
|
||||
var posEnums, posMessages, posExtensions int
|
||||
b0 := b
|
||||
@ -387,7 +387,7 @@ func (md *Message) unmarshalSeedOptions(b []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
xd.L0.ParentFile = pf
|
||||
xd.L0.Parent = pd
|
||||
xd.L0.Index = i
|
||||
@ -401,11 +401,11 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.FieldDescriptorProto_Number_field_number:
|
||||
xd.L1.Number = pref.FieldNumber(v)
|
||||
xd.L1.Number = protoreflect.FieldNumber(v)
|
||||
case genid.FieldDescriptorProto_Label_field_number:
|
||||
xd.L1.Cardinality = pref.Cardinality(v)
|
||||
xd.L1.Cardinality = protoreflect.Cardinality(v)
|
||||
case genid.FieldDescriptorProto_Type_field_number:
|
||||
xd.L1.Kind = pref.Kind(v)
|
||||
xd.L1.Kind = protoreflect.Kind(v)
|
||||
}
|
||||
case protowire.BytesType:
|
||||
v, m := protowire.ConsumeBytes(b)
|
||||
@ -423,7 +423,7 @@ func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||
}
|
||||
}
|
||||
|
||||
func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
sd.L0.ParentFile = pf
|
||||
sd.L0.Parent = pd
|
||||
sd.L0.Index = i
|
||||
@ -459,13 +459,13 @@ func putBuilder(b *strs.Builder) {
|
||||
|
||||
// makeFullName converts b to a protoreflect.FullName,
|
||||
// where b must start with a leading dot.
|
||||
func makeFullName(sb *strs.Builder, b []byte) pref.FullName {
|
||||
func makeFullName(sb *strs.Builder, b []byte) protoreflect.FullName {
|
||||
if len(b) == 0 || b[0] != '.' {
|
||||
panic("name reference must be fully qualified")
|
||||
}
|
||||
return pref.FullName(sb.MakeString(b[1:]))
|
||||
return protoreflect.FullName(sb.MakeString(b[1:]))
|
||||
}
|
||||
|
||||
func appendFullName(sb *strs.Builder, prefix pref.FullName, suffix []byte) pref.FullName {
|
||||
return sb.AppendFullName(prefix, pref.Name(strs.UnsafeString(suffix)))
|
||||
func appendFullName(sb *strs.Builder, prefix protoreflect.FullName, suffix []byte) protoreflect.FullName {
|
||||
return sb.AppendFullName(prefix, protoreflect.Name(strs.UnsafeString(suffix)))
|
||||
}
|
||||
|
84
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
84
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
generated
vendored
@ -13,7 +13,7 @@ import (
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
"google.golang.org/protobuf/proto"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
func (fd *File) lazyRawInit() {
|
||||
@ -39,10 +39,10 @@ func (file *File) resolveMessages() {
|
||||
|
||||
// Resolve message field dependency.
|
||||
switch fd.L1.Kind {
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)
|
||||
depIdx++
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
|
||||
depIdx++
|
||||
}
|
||||
@ -62,10 +62,10 @@ func (file *File) resolveExtensions() {
|
||||
|
||||
// Resolve extension field dependency.
|
||||
switch xd.L1.Kind {
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)
|
||||
depIdx++
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)
|
||||
depIdx++
|
||||
}
|
||||
@ -92,7 +92,7 @@ func (file *File) resolveServices() {
|
||||
}
|
||||
}
|
||||
|
||||
func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref.EnumDescriptor {
|
||||
func (file *File) resolveEnumDependency(ed protoreflect.EnumDescriptor, i, j int32) protoreflect.EnumDescriptor {
|
||||
r := file.builder.FileRegistry
|
||||
if r, ok := r.(resolverByIndex); ok {
|
||||
if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {
|
||||
@ -105,12 +105,12 @@ func (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref
|
||||
}
|
||||
}
|
||||
if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {
|
||||
return d.(pref.EnumDescriptor)
|
||||
return d.(protoreflect.EnumDescriptor)
|
||||
}
|
||||
return ed
|
||||
}
|
||||
|
||||
func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32) pref.MessageDescriptor {
|
||||
func (file *File) resolveMessageDependency(md protoreflect.MessageDescriptor, i, j int32) protoreflect.MessageDescriptor {
|
||||
r := file.builder.FileRegistry
|
||||
if r, ok := r.(resolverByIndex); ok {
|
||||
if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {
|
||||
@ -123,7 +123,7 @@ func (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32
|
||||
}
|
||||
}
|
||||
if d, _ := r.FindDescriptorByName(md.FullName()); d != nil {
|
||||
return d.(pref.MessageDescriptor)
|
||||
return d.(protoreflect.MessageDescriptor)
|
||||
}
|
||||
return md
|
||||
}
|
||||
@ -158,7 +158,7 @@ func (fd *File) unmarshalFull(b []byte) {
|
||||
if imp == nil {
|
||||
imp = PlaceholderFile(path)
|
||||
}
|
||||
fd.L2.Imports = append(fd.L2.Imports, pref.FileImport{FileDescriptor: imp})
|
||||
fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp})
|
||||
case genid.FileDescriptorProto_EnumType_field_number:
|
||||
fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
|
||||
enumIdx++
|
||||
@ -199,7 +199,7 @@ func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
case genid.EnumDescriptorProto_Value_field_number:
|
||||
rawValues = append(rawValues, v)
|
||||
case genid.EnumDescriptorProto_ReservedName_field_number:
|
||||
ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))
|
||||
ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
|
||||
case genid.EnumDescriptorProto_ReservedRange_field_number:
|
||||
ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))
|
||||
case genid.EnumDescriptorProto_Options_field_number:
|
||||
@ -219,7 +219,7 @@ func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)
|
||||
}
|
||||
|
||||
func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
||||
func unmarshalEnumReservedRange(b []byte) (r [2]protoreflect.EnumNumber) {
|
||||
for len(b) > 0 {
|
||||
num, typ, n := protowire.ConsumeTag(b)
|
||||
b = b[n:]
|
||||
@ -229,9 +229,9 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:
|
||||
r[0] = pref.EnumNumber(v)
|
||||
r[0] = protoreflect.EnumNumber(v)
|
||||
case genid.EnumDescriptorProto_EnumReservedRange_End_field_number:
|
||||
r[1] = pref.EnumNumber(v)
|
||||
r[1] = protoreflect.EnumNumber(v)
|
||||
}
|
||||
default:
|
||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||
@ -241,7 +241,7 @@ func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
|
||||
return r
|
||||
}
|
||||
|
||||
func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
vd.L0.ParentFile = pf
|
||||
vd.L0.Parent = pd
|
||||
vd.L0.Index = i
|
||||
@ -256,7 +256,7 @@ func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.EnumValueDescriptorProto_Number_field_number:
|
||||
vd.L1.Number = pref.EnumNumber(v)
|
||||
vd.L1.Number = protoreflect.EnumNumber(v)
|
||||
}
|
||||
case protowire.BytesType:
|
||||
v, m := protowire.ConsumeBytes(b)
|
||||
@ -294,7 +294,7 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
case genid.DescriptorProto_OneofDecl_field_number:
|
||||
rawOneofs = append(rawOneofs, v)
|
||||
case genid.DescriptorProto_ReservedName_field_number:
|
||||
md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))
|
||||
md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
|
||||
case genid.DescriptorProto_ReservedRange_field_number:
|
||||
md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))
|
||||
case genid.DescriptorProto_ExtensionRange_field_number:
|
||||
@ -326,7 +326,7 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
for i, b := range rawFields {
|
||||
fd := &md.L2.Fields.List[i]
|
||||
fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
|
||||
if fd.L1.Cardinality == pref.Required {
|
||||
if fd.L1.Cardinality == protoreflect.Required {
|
||||
md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)
|
||||
}
|
||||
}
|
||||
@ -359,7 +359,7 @@ func (md *Message) unmarshalOptions(b []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
||||
func unmarshalMessageReservedRange(b []byte) (r [2]protoreflect.FieldNumber) {
|
||||
for len(b) > 0 {
|
||||
num, typ, n := protowire.ConsumeTag(b)
|
||||
b = b[n:]
|
||||
@ -369,9 +369,9 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.DescriptorProto_ReservedRange_Start_field_number:
|
||||
r[0] = pref.FieldNumber(v)
|
||||
r[0] = protoreflect.FieldNumber(v)
|
||||
case genid.DescriptorProto_ReservedRange_End_field_number:
|
||||
r[1] = pref.FieldNumber(v)
|
||||
r[1] = protoreflect.FieldNumber(v)
|
||||
}
|
||||
default:
|
||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||
@ -381,7 +381,7 @@ func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
|
||||
return r
|
||||
}
|
||||
|
||||
func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) {
|
||||
func unmarshalMessageExtensionRange(b []byte) (r [2]protoreflect.FieldNumber, rawOptions []byte) {
|
||||
for len(b) > 0 {
|
||||
num, typ, n := protowire.ConsumeTag(b)
|
||||
b = b[n:]
|
||||
@ -391,9 +391,9 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.DescriptorProto_ExtensionRange_Start_field_number:
|
||||
r[0] = pref.FieldNumber(v)
|
||||
r[0] = protoreflect.FieldNumber(v)
|
||||
case genid.DescriptorProto_ExtensionRange_End_field_number:
|
||||
r[1] = pref.FieldNumber(v)
|
||||
r[1] = protoreflect.FieldNumber(v)
|
||||
}
|
||||
case protowire.BytesType:
|
||||
v, m := protowire.ConsumeBytes(b)
|
||||
@ -410,7 +410,7 @@ func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions
|
||||
return r, rawOptions
|
||||
}
|
||||
|
||||
func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
fd.L0.ParentFile = pf
|
||||
fd.L0.Parent = pd
|
||||
fd.L0.Index = i
|
||||
@ -426,11 +426,11 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.FieldDescriptorProto_Number_field_number:
|
||||
fd.L1.Number = pref.FieldNumber(v)
|
||||
fd.L1.Number = protoreflect.FieldNumber(v)
|
||||
case genid.FieldDescriptorProto_Label_field_number:
|
||||
fd.L1.Cardinality = pref.Cardinality(v)
|
||||
fd.L1.Cardinality = protoreflect.Cardinality(v)
|
||||
case genid.FieldDescriptorProto_Type_field_number:
|
||||
fd.L1.Kind = pref.Kind(v)
|
||||
fd.L1.Kind = protoreflect.Kind(v)
|
||||
case genid.FieldDescriptorProto_OneofIndex_field_number:
|
||||
// In Message.unmarshalFull, we allocate slices for both
|
||||
// the field and oneof descriptors before unmarshaling either
|
||||
@ -451,9 +451,9 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
||||
case genid.FieldDescriptorProto_Name_field_number:
|
||||
fd.L0.FullName = appendFullName(sb, pd.FullName(), v)
|
||||
case genid.FieldDescriptorProto_JsonName_field_number:
|
||||
fd.L1.JSONName.Init(sb.MakeString(v))
|
||||
fd.L1.StringName.InitJSON(sb.MakeString(v))
|
||||
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
||||
fd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
|
||||
fd.L1.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
|
||||
case genid.FieldDescriptorProto_TypeName_field_number:
|
||||
rawTypeName = v
|
||||
case genid.FieldDescriptorProto_Options_field_number:
|
||||
@ -468,9 +468,9 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Des
|
||||
if rawTypeName != nil {
|
||||
name := makeFullName(sb, rawTypeName)
|
||||
switch fd.L1.Kind {
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
fd.L1.Enum = PlaceholderEnum(name)
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
fd.L1.Message = PlaceholderMessage(name)
|
||||
}
|
||||
}
|
||||
@ -504,7 +504,7 @@ func (fd *Field) unmarshalOptions(b []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
od.L0.ParentFile = pf
|
||||
od.L0.Parent = pd
|
||||
od.L0.Index = i
|
||||
@ -551,9 +551,9 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
b = b[m:]
|
||||
switch num {
|
||||
case genid.FieldDescriptorProto_JsonName_field_number:
|
||||
xd.L2.JSONName.Init(sb.MakeString(v))
|
||||
xd.L2.StringName.InitJSON(sb.MakeString(v))
|
||||
case genid.FieldDescriptorProto_DefaultValue_field_number:
|
||||
xd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
|
||||
xd.L2.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
|
||||
case genid.FieldDescriptorProto_TypeName_field_number:
|
||||
rawTypeName = v
|
||||
case genid.FieldDescriptorProto_Options_field_number:
|
||||
@ -568,9 +568,9 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
if rawTypeName != nil {
|
||||
name := makeFullName(sb, rawTypeName)
|
||||
switch xd.L1.Kind {
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
xd.L2.Enum = PlaceholderEnum(name)
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
xd.L2.Message = PlaceholderMessage(name)
|
||||
}
|
||||
}
|
||||
@ -627,7 +627,7 @@ func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||
sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)
|
||||
}
|
||||
|
||||
func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {
|
||||
func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||
md.L0.ParentFile = pf
|
||||
md.L0.Parent = pd
|
||||
md.L0.Index = i
|
||||
@ -680,18 +680,18 @@ func appendOptions(dst, src []byte) []byte {
|
||||
//
|
||||
// The type of message to unmarshal to is passed as a pointer since the
|
||||
// vars in descopts may not yet be populated at the time this function is called.
|
||||
func (db *Builder) optionsUnmarshaler(p *pref.ProtoMessage, b []byte) func() pref.ProtoMessage {
|
||||
func (db *Builder) optionsUnmarshaler(p *protoreflect.ProtoMessage, b []byte) func() protoreflect.ProtoMessage {
|
||||
if b == nil {
|
||||
return nil
|
||||
}
|
||||
var opts pref.ProtoMessage
|
||||
var opts protoreflect.ProtoMessage
|
||||
var once sync.Once
|
||||
return func() pref.ProtoMessage {
|
||||
return func() protoreflect.ProtoMessage {
|
||||
once.Do(func() {
|
||||
if *p == nil {
|
||||
panic("Descriptor.Options called without importing the descriptor package")
|
||||
}
|
||||
opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(pref.ProtoMessage)
|
||||
opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(protoreflect.ProtoMessage)
|
||||
if err := (proto.UnmarshalOptions{
|
||||
AllowPartial: true,
|
||||
Resolver: db.TypeResolver,
|
||||
|
257
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
generated
vendored
257
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
generated
vendored
@ -6,39 +6,41 @@ package filedesc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/descfmt"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type FileImports []pref.FileImport
|
||||
type FileImports []protoreflect.FileImport
|
||||
|
||||
func (p *FileImports) Len() int { return len(*p) }
|
||||
func (p *FileImports) Get(i int) pref.FileImport { return (*p)[i] }
|
||||
func (p *FileImports) Get(i int) protoreflect.FileImport { return (*p)[i] }
|
||||
func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||
func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
type Names struct {
|
||||
List []pref.Name
|
||||
List []protoreflect.Name
|
||||
once sync.Once
|
||||
has map[pref.Name]int // protected by once
|
||||
has map[protoreflect.Name]int // protected by once
|
||||
}
|
||||
|
||||
func (p *Names) Len() int { return len(p.List) }
|
||||
func (p *Names) Get(i int) pref.Name { return p.List[i] }
|
||||
func (p *Names) Has(s pref.Name) bool { return p.lazyInit().has[s] > 0 }
|
||||
func (p *Names) Get(i int) protoreflect.Name { return p.List[i] }
|
||||
func (p *Names) Has(s protoreflect.Name) bool { return p.lazyInit().has[s] > 0 }
|
||||
func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||
func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (p *Names) lazyInit() *Names {
|
||||
p.once.Do(func() {
|
||||
if len(p.List) > 0 {
|
||||
p.has = make(map[pref.Name]int, len(p.List))
|
||||
p.has = make(map[protoreflect.Name]int, len(p.List))
|
||||
for _, s := range p.List {
|
||||
p.has[s] = p.has[s] + 1
|
||||
}
|
||||
@ -64,14 +66,14 @@ func (p *Names) CheckValid() error {
|
||||
}
|
||||
|
||||
type EnumRanges struct {
|
||||
List [][2]pref.EnumNumber // start inclusive; end inclusive
|
||||
List [][2]protoreflect.EnumNumber // start inclusive; end inclusive
|
||||
once sync.Once
|
||||
sorted [][2]pref.EnumNumber // protected by once
|
||||
sorted [][2]protoreflect.EnumNumber // protected by once
|
||||
}
|
||||
|
||||
func (p *EnumRanges) Len() int { return len(p.List) }
|
||||
func (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] }
|
||||
func (p *EnumRanges) Has(n pref.EnumNumber) bool {
|
||||
func (p *EnumRanges) Len() int { return len(p.List) }
|
||||
func (p *EnumRanges) Get(i int) [2]protoreflect.EnumNumber { return p.List[i] }
|
||||
func (p *EnumRanges) Has(n protoreflect.EnumNumber) bool {
|
||||
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
||||
i := len(ls) / 2
|
||||
switch r := enumRange(ls[i]); {
|
||||
@ -126,14 +128,14 @@ func (r enumRange) String() string {
|
||||
}
|
||||
|
||||
type FieldRanges struct {
|
||||
List [][2]pref.FieldNumber // start inclusive; end exclusive
|
||||
List [][2]protoreflect.FieldNumber // start inclusive; end exclusive
|
||||
once sync.Once
|
||||
sorted [][2]pref.FieldNumber // protected by once
|
||||
sorted [][2]protoreflect.FieldNumber // protected by once
|
||||
}
|
||||
|
||||
func (p *FieldRanges) Len() int { return len(p.List) }
|
||||
func (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] }
|
||||
func (p *FieldRanges) Has(n pref.FieldNumber) bool {
|
||||
func (p *FieldRanges) Len() int { return len(p.List) }
|
||||
func (p *FieldRanges) Get(i int) [2]protoreflect.FieldNumber { return p.List[i] }
|
||||
func (p *FieldRanges) Has(n protoreflect.FieldNumber) bool {
|
||||
for ls := p.lazyInit().sorted; len(ls) > 0; {
|
||||
i := len(ls) / 2
|
||||
switch r := fieldRange(ls[i]); {
|
||||
@ -218,17 +220,17 @@ func (r fieldRange) String() string {
|
||||
}
|
||||
|
||||
type FieldNumbers struct {
|
||||
List []pref.FieldNumber
|
||||
List []protoreflect.FieldNumber
|
||||
once sync.Once
|
||||
has map[pref.FieldNumber]struct{} // protected by once
|
||||
has map[protoreflect.FieldNumber]struct{} // protected by once
|
||||
}
|
||||
|
||||
func (p *FieldNumbers) Len() int { return len(p.List) }
|
||||
func (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] }
|
||||
func (p *FieldNumbers) Has(n pref.FieldNumber) bool {
|
||||
func (p *FieldNumbers) Len() int { return len(p.List) }
|
||||
func (p *FieldNumbers) Get(i int) protoreflect.FieldNumber { return p.List[i] }
|
||||
func (p *FieldNumbers) Has(n protoreflect.FieldNumber) bool {
|
||||
p.once.Do(func() {
|
||||
if len(p.List) > 0 {
|
||||
p.has = make(map[pref.FieldNumber]struct{}, len(p.List))
|
||||
p.has = make(map[protoreflect.FieldNumber]struct{}, len(p.List))
|
||||
for _, n := range p.List {
|
||||
p.has[n] = struct{}{}
|
||||
}
|
||||
@ -241,31 +243,43 @@ func (p *FieldNumbers) Format(s fmt.State, r rune) { descfmt.FormatList
|
||||
func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
type OneofFields struct {
|
||||
List []pref.FieldDescriptor
|
||||
List []protoreflect.FieldDescriptor
|
||||
once sync.Once
|
||||
byName map[pref.Name]pref.FieldDescriptor // protected by once
|
||||
byJSON map[string]pref.FieldDescriptor // protected by once
|
||||
byNum map[pref.FieldNumber]pref.FieldDescriptor // protected by once
|
||||
byName map[protoreflect.Name]protoreflect.FieldDescriptor // protected by once
|
||||
byJSON map[string]protoreflect.FieldDescriptor // protected by once
|
||||
byText map[string]protoreflect.FieldDescriptor // protected by once
|
||||
byNum map[protoreflect.FieldNumber]protoreflect.FieldDescriptor // protected by once
|
||||
}
|
||||
|
||||
func (p *OneofFields) Len() int { return len(p.List) }
|
||||
func (p *OneofFields) Get(i int) pref.FieldDescriptor { return p.List[i] }
|
||||
func (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.lazyInit().byName[s] }
|
||||
func (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.lazyInit().byJSON[s] }
|
||||
func (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }
|
||||
func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||
func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
|
||||
func (p *OneofFields) Len() int { return len(p.List) }
|
||||
func (p *OneofFields) Get(i int) protoreflect.FieldDescriptor { return p.List[i] }
|
||||
func (p *OneofFields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
|
||||
return p.lazyInit().byName[s]
|
||||
}
|
||||
func (p *OneofFields) ByJSONName(s string) protoreflect.FieldDescriptor {
|
||||
return p.lazyInit().byJSON[s]
|
||||
}
|
||||
func (p *OneofFields) ByTextName(s string) protoreflect.FieldDescriptor {
|
||||
return p.lazyInit().byText[s]
|
||||
}
|
||||
func (p *OneofFields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
|
||||
return p.lazyInit().byNum[n]
|
||||
}
|
||||
func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
|
||||
func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
func (p *OneofFields) lazyInit() *OneofFields {
|
||||
p.once.Do(func() {
|
||||
if len(p.List) > 0 {
|
||||
p.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List))
|
||||
p.byJSON = make(map[string]pref.FieldDescriptor, len(p.List))
|
||||
p.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List))
|
||||
p.byName = make(map[protoreflect.Name]protoreflect.FieldDescriptor, len(p.List))
|
||||
p.byJSON = make(map[string]protoreflect.FieldDescriptor, len(p.List))
|
||||
p.byText = make(map[string]protoreflect.FieldDescriptor, len(p.List))
|
||||
p.byNum = make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor, len(p.List))
|
||||
for _, f := range p.List {
|
||||
// Field names and numbers are guaranteed to be unique.
|
||||
p.byName[f.Name()] = f
|
||||
p.byJSON[f.JSONName()] = f
|
||||
p.byText[f.TextName()] = f
|
||||
p.byNum[f.Number()] = f
|
||||
}
|
||||
}
|
||||
@ -274,9 +288,170 @@ func (p *OneofFields) lazyInit() *OneofFields {
|
||||
}
|
||||
|
||||
type SourceLocations struct {
|
||||
List []pref.SourceLocation
|
||||
// List is a list of SourceLocations.
|
||||
// The SourceLocation.Next field does not need to be populated
|
||||
// as it will be lazily populated upon first need.
|
||||
List []protoreflect.SourceLocation
|
||||
|
||||
// File is the parent file descriptor that these locations are relative to.
|
||||
// If non-nil, ByDescriptor verifies that the provided descriptor
|
||||
// is a child of this file descriptor.
|
||||
File protoreflect.FileDescriptor
|
||||
|
||||
once sync.Once
|
||||
byPath map[pathKey]int
|
||||
}
|
||||
|
||||
func (p *SourceLocations) Len() int { return len(p.List) }
|
||||
func (p *SourceLocations) Get(i int) pref.SourceLocation { return p.List[i] }
|
||||
func (p *SourceLocations) Len() int { return len(p.List) }
|
||||
func (p *SourceLocations) Get(i int) protoreflect.SourceLocation { return p.lazyInit().List[i] }
|
||||
func (p *SourceLocations) byKey(k pathKey) protoreflect.SourceLocation {
|
||||
if i, ok := p.lazyInit().byPath[k]; ok {
|
||||
return p.List[i]
|
||||
}
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
func (p *SourceLocations) ByPath(path protoreflect.SourcePath) protoreflect.SourceLocation {
|
||||
return p.byKey(newPathKey(path))
|
||||
}
|
||||
func (p *SourceLocations) ByDescriptor(desc protoreflect.Descriptor) protoreflect.SourceLocation {
|
||||
if p.File != nil && desc != nil && p.File != desc.ParentFile() {
|
||||
return protoreflect.SourceLocation{} // mismatching parent files
|
||||
}
|
||||
var pathArr [16]int32
|
||||
path := pathArr[:0]
|
||||
for {
|
||||
switch desc.(type) {
|
||||
case protoreflect.FileDescriptor:
|
||||
// Reverse the path since it was constructed in reverse.
|
||||
for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
||||
path[i], path[j] = path[j], path[i]
|
||||
}
|
||||
return p.byKey(newPathKey(path))
|
||||
case protoreflect.MessageDescriptor:
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
switch desc.(type) {
|
||||
case protoreflect.FileDescriptor:
|
||||
path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
|
||||
case protoreflect.MessageDescriptor:
|
||||
path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
case protoreflect.FieldDescriptor:
|
||||
isExtension := desc.(protoreflect.FieldDescriptor).IsExtension()
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
if isExtension {
|
||||
switch desc.(type) {
|
||||
case protoreflect.FileDescriptor:
|
||||
path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
|
||||
case protoreflect.MessageDescriptor:
|
||||
path = append(path, int32(genid.DescriptorProto_Extension_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
} else {
|
||||
switch desc.(type) {
|
||||
case protoreflect.MessageDescriptor:
|
||||
path = append(path, int32(genid.DescriptorProto_Field_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
}
|
||||
case protoreflect.OneofDescriptor:
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
switch desc.(type) {
|
||||
case protoreflect.MessageDescriptor:
|
||||
path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
case protoreflect.EnumDescriptor:
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
switch desc.(type) {
|
||||
case protoreflect.FileDescriptor:
|
||||
path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
|
||||
case protoreflect.MessageDescriptor:
|
||||
path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
case protoreflect.EnumValueDescriptor:
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
switch desc.(type) {
|
||||
case protoreflect.EnumDescriptor:
|
||||
path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
case protoreflect.ServiceDescriptor:
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
switch desc.(type) {
|
||||
case protoreflect.FileDescriptor:
|
||||
path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
case protoreflect.MethodDescriptor:
|
||||
path = append(path, int32(desc.Index()))
|
||||
desc = desc.Parent()
|
||||
switch desc.(type) {
|
||||
case protoreflect.ServiceDescriptor:
|
||||
path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
default:
|
||||
return protoreflect.SourceLocation{}
|
||||
}
|
||||
}
|
||||
}
|
||||
func (p *SourceLocations) lazyInit() *SourceLocations {
|
||||
p.once.Do(func() {
|
||||
if len(p.List) > 0 {
|
||||
// Collect all the indexes for a given path.
|
||||
pathIdxs := make(map[pathKey][]int, len(p.List))
|
||||
for i, l := range p.List {
|
||||
k := newPathKey(l.Path)
|
||||
pathIdxs[k] = append(pathIdxs[k], i)
|
||||
}
|
||||
|
||||
// Update the next index for all locations.
|
||||
p.byPath = make(map[pathKey]int, len(p.List))
|
||||
for k, idxs := range pathIdxs {
|
||||
for i := 0; i < len(idxs)-1; i++ {
|
||||
p.List[idxs[i]].Next = idxs[i+1]
|
||||
}
|
||||
p.List[idxs[len(idxs)-1]].Next = 0
|
||||
p.byPath[k] = idxs[0] // record the first location for this path
|
||||
}
|
||||
}
|
||||
})
|
||||
return p
|
||||
}
|
||||
func (p *SourceLocations) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// pathKey is a comparable representation of protoreflect.SourcePath.
|
||||
type pathKey struct {
|
||||
arr [16]uint8 // first n-1 path segments; last element is the length
|
||||
str string // used if the path does not fit in arr
|
||||
}
|
||||
|
||||
func newPathKey(p protoreflect.SourcePath) (k pathKey) {
|
||||
if len(p) < len(k.arr) {
|
||||
for i, ps := range p {
|
||||
if ps < 0 || math.MaxUint8 <= ps {
|
||||
return pathKey{str: p.String()}
|
||||
}
|
||||
k.arr[i] = uint8(ps)
|
||||
}
|
||||
k.arr[len(k.arr)-1] = uint8(len(p))
|
||||
return k
|
||||
}
|
||||
return pathKey{str: p.String()}
|
||||
}
|
||||
|
11
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
generated
vendored
11
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
generated
vendored
@ -142,6 +142,7 @@ type Fields struct {
|
||||
once sync.Once
|
||||
byName map[protoreflect.Name]*Field // protected by once
|
||||
byJSON map[string]*Field // protected by once
|
||||
byText map[string]*Field // protected by once
|
||||
byNum map[protoreflect.FieldNumber]*Field // protected by once
|
||||
}
|
||||
|
||||
@ -163,6 +164,12 @@ func (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor {
|
||||
if d := p.lazyInit().byText[s]; d != nil {
|
||||
return d
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
|
||||
if d := p.lazyInit().byNum[n]; d != nil {
|
||||
return d
|
||||
@ -178,6 +185,7 @@ func (p *Fields) lazyInit() *Fields {
|
||||
if len(p.List) > 0 {
|
||||
p.byName = make(map[protoreflect.Name]*Field, len(p.List))
|
||||
p.byJSON = make(map[string]*Field, len(p.List))
|
||||
p.byText = make(map[string]*Field, len(p.List))
|
||||
p.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List))
|
||||
for i := range p.List {
|
||||
d := &p.List[i]
|
||||
@ -187,6 +195,9 @@ func (p *Fields) lazyInit() *Fields {
|
||||
if _, ok := p.byJSON[d.JSONName()]; !ok {
|
||||
p.byJSON[d.JSONName()] = d
|
||||
}
|
||||
if _, ok := p.byText[d.TextName()]; !ok {
|
||||
p.byText[d.TextName()] = d
|
||||
}
|
||||
if _, ok := p.byNum[d.Number()]; !ok {
|
||||
p.byNum[d.Number()] = d
|
||||
}
|
||||
|
136
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
generated
vendored
136
actions/retest/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
generated
vendored
@ -7,7 +7,7 @@ package filedesc
|
||||
import (
|
||||
"google.golang.org/protobuf/internal/descopts"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -30,78 +30,80 @@ var (
|
||||
// PlaceholderFile is a placeholder, representing only the file path.
|
||||
type PlaceholderFile string
|
||||
|
||||
func (f PlaceholderFile) ParentFile() pref.FileDescriptor { return f }
|
||||
func (f PlaceholderFile) Parent() pref.Descriptor { return nil }
|
||||
func (f PlaceholderFile) Index() int { return 0 }
|
||||
func (f PlaceholderFile) Syntax() pref.Syntax { return 0 }
|
||||
func (f PlaceholderFile) Name() pref.Name { return "" }
|
||||
func (f PlaceholderFile) FullName() pref.FullName { return "" }
|
||||
func (f PlaceholderFile) IsPlaceholder() bool { return true }
|
||||
func (f PlaceholderFile) Options() pref.ProtoMessage { return descopts.File }
|
||||
func (f PlaceholderFile) Path() string { return string(f) }
|
||||
func (f PlaceholderFile) Package() pref.FullName { return "" }
|
||||
func (f PlaceholderFile) Imports() pref.FileImports { return emptyFiles }
|
||||
func (f PlaceholderFile) Messages() pref.MessageDescriptors { return emptyMessages }
|
||||
func (f PlaceholderFile) Enums() pref.EnumDescriptors { return emptyEnums }
|
||||
func (f PlaceholderFile) Extensions() pref.ExtensionDescriptors { return emptyExtensions }
|
||||
func (f PlaceholderFile) Services() pref.ServiceDescriptors { return emptyServices }
|
||||
func (f PlaceholderFile) SourceLocations() pref.SourceLocations { return emptySourceLocations }
|
||||
func (f PlaceholderFile) ProtoType(pref.FileDescriptor) { return }
|
||||
func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
func (f PlaceholderFile) ParentFile() protoreflect.FileDescriptor { return f }
|
||||
func (f PlaceholderFile) Parent() protoreflect.Descriptor { return nil }
|
||||
func (f PlaceholderFile) Index() int { return 0 }
|
||||
func (f PlaceholderFile) Syntax() protoreflect.Syntax { return 0 }
|
||||
func (f PlaceholderFile) Name() protoreflect.Name { return "" }
|
||||
func (f PlaceholderFile) FullName() protoreflect.FullName { return "" }
|
||||
func (f PlaceholderFile) IsPlaceholder() bool { return true }
|
||||
func (f PlaceholderFile) Options() protoreflect.ProtoMessage { return descopts.File }
|
||||
func (f PlaceholderFile) Path() string { return string(f) }
|
||||
func (f PlaceholderFile) Package() protoreflect.FullName { return "" }
|
||||
func (f PlaceholderFile) Imports() protoreflect.FileImports { return emptyFiles }
|
||||
func (f PlaceholderFile) Messages() protoreflect.MessageDescriptors { return emptyMessages }
|
||||
func (f PlaceholderFile) Enums() protoreflect.EnumDescriptors { return emptyEnums }
|
||||
func (f PlaceholderFile) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
|
||||
func (f PlaceholderFile) Services() protoreflect.ServiceDescriptors { return emptyServices }
|
||||
func (f PlaceholderFile) SourceLocations() protoreflect.SourceLocations { return emptySourceLocations }
|
||||
func (f PlaceholderFile) ProtoType(protoreflect.FileDescriptor) { return }
|
||||
func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
|
||||
// PlaceholderEnum is a placeholder, representing only the full name.
|
||||
type PlaceholderEnum pref.FullName
|
||||
type PlaceholderEnum protoreflect.FullName
|
||||
|
||||
func (e PlaceholderEnum) ParentFile() pref.FileDescriptor { return nil }
|
||||
func (e PlaceholderEnum) Parent() pref.Descriptor { return nil }
|
||||
func (e PlaceholderEnum) Index() int { return 0 }
|
||||
func (e PlaceholderEnum) Syntax() pref.Syntax { return 0 }
|
||||
func (e PlaceholderEnum) Name() pref.Name { return pref.FullName(e).Name() }
|
||||
func (e PlaceholderEnum) FullName() pref.FullName { return pref.FullName(e) }
|
||||
func (e PlaceholderEnum) IsPlaceholder() bool { return true }
|
||||
func (e PlaceholderEnum) Options() pref.ProtoMessage { return descopts.Enum }
|
||||
func (e PlaceholderEnum) Values() pref.EnumValueDescriptors { return emptyEnumValues }
|
||||
func (e PlaceholderEnum) ReservedNames() pref.Names { return emptyNames }
|
||||
func (e PlaceholderEnum) ReservedRanges() pref.EnumRanges { return emptyEnumRanges }
|
||||
func (e PlaceholderEnum) ProtoType(pref.EnumDescriptor) { return }
|
||||
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
func (e PlaceholderEnum) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||
func (e PlaceholderEnum) Parent() protoreflect.Descriptor { return nil }
|
||||
func (e PlaceholderEnum) Index() int { return 0 }
|
||||
func (e PlaceholderEnum) Syntax() protoreflect.Syntax { return 0 }
|
||||
func (e PlaceholderEnum) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
|
||||
func (e PlaceholderEnum) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
|
||||
func (e PlaceholderEnum) IsPlaceholder() bool { return true }
|
||||
func (e PlaceholderEnum) Options() protoreflect.ProtoMessage { return descopts.Enum }
|
||||
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) ProtoType(protoreflect.EnumDescriptor) { return }
|
||||
func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
|
||||
// PlaceholderEnumValue is a placeholder, representing only the full name.
|
||||
type PlaceholderEnumValue pref.FullName
|
||||
type PlaceholderEnumValue protoreflect.FullName
|
||||
|
||||
func (e PlaceholderEnumValue) ParentFile() pref.FileDescriptor { return nil }
|
||||
func (e PlaceholderEnumValue) Parent() pref.Descriptor { return nil }
|
||||
func (e PlaceholderEnumValue) Index() int { return 0 }
|
||||
func (e PlaceholderEnumValue) Syntax() pref.Syntax { return 0 }
|
||||
func (e PlaceholderEnumValue) Name() pref.Name { return pref.FullName(e).Name() }
|
||||
func (e PlaceholderEnumValue) FullName() pref.FullName { return pref.FullName(e) }
|
||||
func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
|
||||
func (e PlaceholderEnumValue) Options() pref.ProtoMessage { return descopts.EnumValue }
|
||||
func (e PlaceholderEnumValue) Number() pref.EnumNumber { return 0 }
|
||||
func (e PlaceholderEnumValue) ProtoType(pref.EnumValueDescriptor) { return }
|
||||
func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
func (e PlaceholderEnumValue) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||
func (e PlaceholderEnumValue) Parent() protoreflect.Descriptor { return nil }
|
||||
func (e PlaceholderEnumValue) Index() int { return 0 }
|
||||
func (e PlaceholderEnumValue) Syntax() protoreflect.Syntax { return 0 }
|
||||
func (e PlaceholderEnumValue) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
|
||||
func (e PlaceholderEnumValue) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
|
||||
func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
|
||||
func (e PlaceholderEnumValue) Options() protoreflect.ProtoMessage { return descopts.EnumValue }
|
||||
func (e PlaceholderEnumValue) Number() protoreflect.EnumNumber { return 0 }
|
||||
func (e PlaceholderEnumValue) ProtoType(protoreflect.EnumValueDescriptor) { return }
|
||||
func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
|
||||
// PlaceholderMessage is a placeholder, representing only the full name.
|
||||
type PlaceholderMessage pref.FullName
|
||||
type PlaceholderMessage protoreflect.FullName
|
||||
|
||||
func (m PlaceholderMessage) ParentFile() pref.FileDescriptor { return nil }
|
||||
func (m PlaceholderMessage) Parent() pref.Descriptor { return nil }
|
||||
func (m PlaceholderMessage) Index() int { return 0 }
|
||||
func (m PlaceholderMessage) Syntax() pref.Syntax { return 0 }
|
||||
func (m PlaceholderMessage) Name() pref.Name { return pref.FullName(m).Name() }
|
||||
func (m PlaceholderMessage) FullName() pref.FullName { return pref.FullName(m) }
|
||||
func (m PlaceholderMessage) IsPlaceholder() bool { return true }
|
||||
func (m PlaceholderMessage) Options() pref.ProtoMessage { return descopts.Message }
|
||||
func (m PlaceholderMessage) IsMapEntry() bool { return false }
|
||||
func (m PlaceholderMessage) Fields() pref.FieldDescriptors { return emptyFields }
|
||||
func (m PlaceholderMessage) Oneofs() pref.OneofDescriptors { return emptyOneofs }
|
||||
func (m PlaceholderMessage) ReservedNames() pref.Names { return emptyNames }
|
||||
func (m PlaceholderMessage) ReservedRanges() pref.FieldRanges { return emptyFieldRanges }
|
||||
func (m PlaceholderMessage) RequiredNumbers() pref.FieldNumbers { return emptyFieldNumbers }
|
||||
func (m PlaceholderMessage) ExtensionRanges() pref.FieldRanges { return emptyFieldRanges }
|
||||
func (m PlaceholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic("index out of range") }
|
||||
func (m PlaceholderMessage) Messages() pref.MessageDescriptors { return emptyMessages }
|
||||
func (m PlaceholderMessage) Enums() pref.EnumDescriptors { return emptyEnums }
|
||||
func (m PlaceholderMessage) Extensions() pref.ExtensionDescriptors { return emptyExtensions }
|
||||
func (m PlaceholderMessage) ProtoType(pref.MessageDescriptor) { return }
|
||||
func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
func (m PlaceholderMessage) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||
func (m PlaceholderMessage) Parent() protoreflect.Descriptor { return nil }
|
||||
func (m PlaceholderMessage) Index() int { return 0 }
|
||||
func (m PlaceholderMessage) Syntax() protoreflect.Syntax { return 0 }
|
||||
func (m PlaceholderMessage) Name() protoreflect.Name { return protoreflect.FullName(m).Name() }
|
||||
func (m PlaceholderMessage) FullName() protoreflect.FullName { return protoreflect.FullName(m) }
|
||||
func (m PlaceholderMessage) IsPlaceholder() bool { return true }
|
||||
func (m PlaceholderMessage) Options() protoreflect.ProtoMessage { return descopts.Message }
|
||||
func (m PlaceholderMessage) IsMapEntry() bool { return false }
|
||||
func (m PlaceholderMessage) Fields() protoreflect.FieldDescriptors { return emptyFields }
|
||||
func (m PlaceholderMessage) Oneofs() protoreflect.OneofDescriptors { return emptyOneofs }
|
||||
func (m PlaceholderMessage) ReservedNames() protoreflect.Names { return emptyNames }
|
||||
func (m PlaceholderMessage) ReservedRanges() protoreflect.FieldRanges { return emptyFieldRanges }
|
||||
func (m PlaceholderMessage) RequiredNumbers() protoreflect.FieldNumbers { return emptyFieldNumbers }
|
||||
func (m PlaceholderMessage) ExtensionRanges() protoreflect.FieldRanges { return emptyFieldRanges }
|
||||
func (m PlaceholderMessage) ExtensionRangeOptions(int) protoreflect.ProtoMessage {
|
||||
panic("index out of range")
|
||||
}
|
||||
func (m PlaceholderMessage) Messages() protoreflect.MessageDescriptors { return emptyMessages }
|
||||
func (m PlaceholderMessage) Enums() protoreflect.EnumDescriptors { return emptyEnums }
|
||||
func (m PlaceholderMessage) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
|
||||
func (m PlaceholderMessage) ProtoType(protoreflect.MessageDescriptor) { return }
|
||||
func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
|
87
actions/retest/vendor/google.golang.org/protobuf/internal/filetype/build.go
generated
vendored
87
actions/retest/vendor/google.golang.org/protobuf/internal/filetype/build.go
generated
vendored
@ -10,17 +10,16 @@ import (
|
||||
"reflect"
|
||||
|
||||
"google.golang.org/protobuf/internal/descopts"
|
||||
fdesc "google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
pimpl "google.golang.org/protobuf/internal/impl"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
// Builder constructs type descriptors from a raw file descriptor
|
||||
// and associated Go types for each enum and message declaration.
|
||||
//
|
||||
//
|
||||
// Flattened Ordering
|
||||
// # Flattened Ordering
|
||||
//
|
||||
// The protobuf type system represents declarations as a tree. Certain nodes in
|
||||
// the tree require us to either associate it with a concrete Go type or to
|
||||
@ -52,7 +51,7 @@ import (
|
||||
// that children themselves may have.
|
||||
type Builder struct {
|
||||
// File is the underlying file descriptor builder.
|
||||
File fdesc.Builder
|
||||
File filedesc.Builder
|
||||
|
||||
// GoTypes is a unique set of the Go types for all declarations and
|
||||
// dependencies. Each type is represented as a zero value of the Go type.
|
||||
@ -108,22 +107,22 @@ type Builder struct {
|
||||
// TypeRegistry is the registry to register each type descriptor.
|
||||
// If nil, it uses protoregistry.GlobalTypes.
|
||||
TypeRegistry interface {
|
||||
RegisterMessage(pref.MessageType) error
|
||||
RegisterEnum(pref.EnumType) error
|
||||
RegisterExtension(pref.ExtensionType) error
|
||||
RegisterMessage(protoreflect.MessageType) error
|
||||
RegisterEnum(protoreflect.EnumType) error
|
||||
RegisterExtension(protoreflect.ExtensionType) error
|
||||
}
|
||||
}
|
||||
|
||||
// Out is the output of the builder.
|
||||
type Out struct {
|
||||
File pref.FileDescriptor
|
||||
File protoreflect.FileDescriptor
|
||||
}
|
||||
|
||||
func (tb Builder) Build() (out Out) {
|
||||
// Replace the resolver with one that resolves dependencies by index,
|
||||
// which is faster and more reliable than relying on the global registry.
|
||||
if tb.File.FileRegistry == nil {
|
||||
tb.File.FileRegistry = preg.GlobalFiles
|
||||
tb.File.FileRegistry = protoregistry.GlobalFiles
|
||||
}
|
||||
tb.File.FileRegistry = &resolverByIndex{
|
||||
goTypes: tb.GoTypes,
|
||||
@ -133,7 +132,7 @@ func (tb Builder) Build() (out Out) {
|
||||
|
||||
// Initialize registry if unpopulated.
|
||||
if tb.TypeRegistry == nil {
|
||||
tb.TypeRegistry = preg.GlobalTypes
|
||||
tb.TypeRegistry = protoregistry.GlobalTypes
|
||||
}
|
||||
|
||||
fbOut := tb.File.Build()
|
||||
@ -183,23 +182,23 @@ func (tb Builder) Build() (out Out) {
|
||||
for i := range fbOut.Messages {
|
||||
switch fbOut.Messages[i].Name() {
|
||||
case "FileOptions":
|
||||
descopts.File = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.File = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "EnumOptions":
|
||||
descopts.Enum = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.Enum = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "EnumValueOptions":
|
||||
descopts.EnumValue = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.EnumValue = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "MessageOptions":
|
||||
descopts.Message = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.Message = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "FieldOptions":
|
||||
descopts.Field = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.Field = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "OneofOptions":
|
||||
descopts.Oneof = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.Oneof = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "ExtensionRangeOptions":
|
||||
descopts.ExtensionRange = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.ExtensionRange = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "ServiceOptions":
|
||||
descopts.Service = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.Service = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
case "MethodOptions":
|
||||
descopts.Method = messageGoTypes[i].(pref.ProtoMessage)
|
||||
descopts.Method = messageGoTypes[i].(protoreflect.ProtoMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -216,11 +215,11 @@ func (tb Builder) Build() (out Out) {
|
||||
const listExtDeps = 2
|
||||
var goType reflect.Type
|
||||
switch fbOut.Extensions[i].L1.Kind {
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
||||
goType = reflect.TypeOf(tb.GoTypes[j])
|
||||
depIdx++
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
|
||||
goType = reflect.TypeOf(tb.GoTypes[j])
|
||||
depIdx++
|
||||
@ -242,22 +241,22 @@ func (tb Builder) Build() (out Out) {
|
||||
return out
|
||||
}
|
||||
|
||||
var goTypeForPBKind = map[pref.Kind]reflect.Type{
|
||||
pref.BoolKind: reflect.TypeOf(bool(false)),
|
||||
pref.Int32Kind: reflect.TypeOf(int32(0)),
|
||||
pref.Sint32Kind: reflect.TypeOf(int32(0)),
|
||||
pref.Sfixed32Kind: reflect.TypeOf(int32(0)),
|
||||
pref.Int64Kind: reflect.TypeOf(int64(0)),
|
||||
pref.Sint64Kind: reflect.TypeOf(int64(0)),
|
||||
pref.Sfixed64Kind: reflect.TypeOf(int64(0)),
|
||||
pref.Uint32Kind: reflect.TypeOf(uint32(0)),
|
||||
pref.Fixed32Kind: reflect.TypeOf(uint32(0)),
|
||||
pref.Uint64Kind: reflect.TypeOf(uint64(0)),
|
||||
pref.Fixed64Kind: reflect.TypeOf(uint64(0)),
|
||||
pref.FloatKind: reflect.TypeOf(float32(0)),
|
||||
pref.DoubleKind: reflect.TypeOf(float64(0)),
|
||||
pref.StringKind: reflect.TypeOf(string("")),
|
||||
pref.BytesKind: reflect.TypeOf([]byte(nil)),
|
||||
var goTypeForPBKind = map[protoreflect.Kind]reflect.Type{
|
||||
protoreflect.BoolKind: reflect.TypeOf(bool(false)),
|
||||
protoreflect.Int32Kind: reflect.TypeOf(int32(0)),
|
||||
protoreflect.Sint32Kind: reflect.TypeOf(int32(0)),
|
||||
protoreflect.Sfixed32Kind: reflect.TypeOf(int32(0)),
|
||||
protoreflect.Int64Kind: reflect.TypeOf(int64(0)),
|
||||
protoreflect.Sint64Kind: reflect.TypeOf(int64(0)),
|
||||
protoreflect.Sfixed64Kind: reflect.TypeOf(int64(0)),
|
||||
protoreflect.Uint32Kind: reflect.TypeOf(uint32(0)),
|
||||
protoreflect.Fixed32Kind: reflect.TypeOf(uint32(0)),
|
||||
protoreflect.Uint64Kind: reflect.TypeOf(uint64(0)),
|
||||
protoreflect.Fixed64Kind: reflect.TypeOf(uint64(0)),
|
||||
protoreflect.FloatKind: reflect.TypeOf(float32(0)),
|
||||
protoreflect.DoubleKind: reflect.TypeOf(float64(0)),
|
||||
protoreflect.StringKind: reflect.TypeOf(string("")),
|
||||
protoreflect.BytesKind: reflect.TypeOf([]byte(nil)),
|
||||
}
|
||||
|
||||
type depIdxs []int32
|
||||
@ -274,13 +273,13 @@ type (
|
||||
fileRegistry
|
||||
}
|
||||
fileRegistry interface {
|
||||
FindFileByPath(string) (pref.FileDescriptor, error)
|
||||
FindDescriptorByName(pref.FullName) (pref.Descriptor, error)
|
||||
RegisterFile(pref.FileDescriptor) error
|
||||
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||
RegisterFile(protoreflect.FileDescriptor) error
|
||||
}
|
||||
)
|
||||
|
||||
func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.EnumDescriptor {
|
||||
func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.EnumDescriptor {
|
||||
if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {
|
||||
return &es[depIdx]
|
||||
} else {
|
||||
@ -288,7 +287,7 @@ func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdes
|
||||
}
|
||||
}
|
||||
|
||||
func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.MessageDescriptor {
|
||||
func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.MessageDescriptor {
|
||||
if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {
|
||||
return &ms[depIdx-len(es)]
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !protolegacy
|
||||
// +build !protolegacy
|
||||
|
||||
package flags
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build protolegacy
|
||||
// +build protolegacy
|
||||
|
||||
package flags
|
||||
|
44
actions/retest/vendor/google.golang.org/protobuf/internal/impl/api_export.go
generated
vendored
44
actions/retest/vendor/google.golang.org/protobuf/internal/impl/api_export.go
generated
vendored
@ -12,8 +12,8 @@ import (
|
||||
"google.golang.org/protobuf/encoding/prototext"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// Export is a zero-length named type that exists only to export a set of
|
||||
@ -32,11 +32,11 @@ type enum = interface{}
|
||||
|
||||
// EnumOf returns the protoreflect.Enum interface over e.
|
||||
// It returns nil if e is nil.
|
||||
func (Export) EnumOf(e enum) pref.Enum {
|
||||
func (Export) EnumOf(e enum) protoreflect.Enum {
|
||||
switch e := e.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case pref.Enum:
|
||||
case protoreflect.Enum:
|
||||
return e
|
||||
default:
|
||||
return legacyWrapEnum(reflect.ValueOf(e))
|
||||
@ -45,11 +45,11 @@ func (Export) EnumOf(e enum) pref.Enum {
|
||||
|
||||
// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.
|
||||
// It returns nil if e is nil.
|
||||
func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {
|
||||
func (Export) EnumDescriptorOf(e enum) protoreflect.EnumDescriptor {
|
||||
switch e := e.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case pref.Enum:
|
||||
case protoreflect.Enum:
|
||||
return e.Descriptor()
|
||||
default:
|
||||
return LegacyLoadEnumDesc(reflect.TypeOf(e))
|
||||
@ -58,11 +58,11 @@ func (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {
|
||||
|
||||
// EnumTypeOf returns the protoreflect.EnumType for e.
|
||||
// It returns nil if e is nil.
|
||||
func (Export) EnumTypeOf(e enum) pref.EnumType {
|
||||
func (Export) EnumTypeOf(e enum) protoreflect.EnumType {
|
||||
switch e := e.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case pref.Enum:
|
||||
case protoreflect.Enum:
|
||||
return e.Type()
|
||||
default:
|
||||
return legacyLoadEnumType(reflect.TypeOf(e))
|
||||
@ -71,7 +71,7 @@ func (Export) EnumTypeOf(e enum) pref.EnumType {
|
||||
|
||||
// EnumStringOf returns the enum value as a string, either as the name if
|
||||
// the number is resolvable, or the number formatted as a string.
|
||||
func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {
|
||||
func (Export) EnumStringOf(ed protoreflect.EnumDescriptor, n protoreflect.EnumNumber) string {
|
||||
ev := ed.Values().ByNumber(n)
|
||||
if ev != nil {
|
||||
return string(ev.Name())
|
||||
@ -84,7 +84,7 @@ func (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {
|
||||
type message = interface{}
|
||||
|
||||
// legacyMessageWrapper wraps a v2 message as a v1 message.
|
||||
type legacyMessageWrapper struct{ m pref.ProtoMessage }
|
||||
type legacyMessageWrapper struct{ m protoreflect.ProtoMessage }
|
||||
|
||||
func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) }
|
||||
func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }
|
||||
@ -92,30 +92,30 @@ func (m legacyMessageWrapper) ProtoMessage() {}
|
||||
|
||||
// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.
|
||||
// It returns nil if m is nil.
|
||||
func (Export) ProtoMessageV1Of(m message) piface.MessageV1 {
|
||||
func (Export) ProtoMessageV1Of(m message) protoiface.MessageV1 {
|
||||
switch mv := m.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case piface.MessageV1:
|
||||
case protoiface.MessageV1:
|
||||
return mv
|
||||
case unwrapper:
|
||||
return Export{}.ProtoMessageV1Of(mv.protoUnwrap())
|
||||
case pref.ProtoMessage:
|
||||
case protoreflect.ProtoMessage:
|
||||
return legacyMessageWrapper{mv}
|
||||
default:
|
||||
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
||||
}
|
||||
}
|
||||
|
||||
func (Export) protoMessageV2Of(m message) pref.ProtoMessage {
|
||||
func (Export) protoMessageV2Of(m message) protoreflect.ProtoMessage {
|
||||
switch mv := m.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
case pref.ProtoMessage:
|
||||
case protoreflect.ProtoMessage:
|
||||
return mv
|
||||
case legacyMessageWrapper:
|
||||
return mv.m
|
||||
case piface.MessageV1:
|
||||
case protoiface.MessageV1:
|
||||
return nil
|
||||
default:
|
||||
panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
|
||||
@ -124,7 +124,7 @@ func (Export) protoMessageV2Of(m message) pref.ProtoMessage {
|
||||
|
||||
// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.
|
||||
// It returns nil if m is nil.
|
||||
func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {
|
||||
func (Export) ProtoMessageV2Of(m message) protoreflect.ProtoMessage {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
@ -136,7 +136,7 @@ func (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {
|
||||
|
||||
// MessageOf returns the protoreflect.Message interface over m.
|
||||
// It returns nil if m is nil.
|
||||
func (Export) MessageOf(m message) pref.Message {
|
||||
func (Export) MessageOf(m message) protoreflect.Message {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
@ -148,7 +148,7 @@ func (Export) MessageOf(m message) pref.Message {
|
||||
|
||||
// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.
|
||||
// It returns nil if m is nil.
|
||||
func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {
|
||||
func (Export) MessageDescriptorOf(m message) protoreflect.MessageDescriptor {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
@ -160,18 +160,18 @@ func (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {
|
||||
|
||||
// MessageTypeOf returns the protoreflect.MessageType for m.
|
||||
// It returns nil if m is nil.
|
||||
func (Export) MessageTypeOf(m message) pref.MessageType {
|
||||
func (Export) MessageTypeOf(m message) protoreflect.MessageType {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
if mv := (Export{}).protoMessageV2Of(m); mv != nil {
|
||||
return mv.ProtoReflect().Type()
|
||||
}
|
||||
return legacyLoadMessageInfo(reflect.TypeOf(m), "")
|
||||
return legacyLoadMessageType(reflect.TypeOf(m), "")
|
||||
}
|
||||
|
||||
// MessageStringOf returns the message value as a string,
|
||||
// which is the message serialized in the protobuf text format.
|
||||
func (Export) MessageStringOf(m pref.ProtoMessage) string {
|
||||
func (Export) MessageStringOf(m protoreflect.ProtoMessage) string {
|
||||
return prototext.MarshalOptions{Multiline: false}.Format(m)
|
||||
}
|
||||
|
12
actions/retest/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
generated
vendored
12
actions/retest/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
generated
vendored
@ -8,18 +8,18 @@ import (
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
func (mi *MessageInfo) checkInitialized(in piface.CheckInitializedInput) (piface.CheckInitializedOutput, error) {
|
||||
func (mi *MessageInfo) checkInitialized(in protoiface.CheckInitializedInput) (protoiface.CheckInitializedOutput, error) {
|
||||
var p pointer
|
||||
if ms, ok := in.Message.(*messageState); ok {
|
||||
p = ms.pointer()
|
||||
} else {
|
||||
p = in.Message.(*messageReflectWrapper).pointer()
|
||||
}
|
||||
return piface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
|
||||
return protoiface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
|
||||
}
|
||||
|
||||
func (mi *MessageInfo) checkInitializedPointer(p pointer) error {
|
||||
@ -90,7 +90,7 @@ var (
|
||||
// needsInitCheck reports whether a message needs to be checked for partial initialization.
|
||||
//
|
||||
// It returns true if the message transitively includes any required or extension fields.
|
||||
func needsInitCheck(md pref.MessageDescriptor) bool {
|
||||
func needsInitCheck(md protoreflect.MessageDescriptor) bool {
|
||||
if v, ok := needsInitCheckMap.Load(md); ok {
|
||||
if has, ok := v.(bool); ok {
|
||||
return has
|
||||
@ -101,7 +101,7 @@ func needsInitCheck(md pref.MessageDescriptor) bool {
|
||||
return needsInitCheckLocked(md)
|
||||
}
|
||||
|
||||
func needsInitCheckLocked(md pref.MessageDescriptor) (has bool) {
|
||||
func needsInitCheckLocked(md protoreflect.MessageDescriptor) (has bool) {
|
||||
if v, ok := needsInitCheckMap.Load(md); ok {
|
||||
// If has is true, we've previously determined that this message
|
||||
// needs init checks.
|
||||
|
36
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
36
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type extensionFieldInfo struct {
|
||||
@ -23,7 +23,7 @@ type extensionFieldInfo struct {
|
||||
|
||||
var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo
|
||||
|
||||
func getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
||||
func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
||||
if xi, ok := xt.(*ExtensionInfo); ok {
|
||||
xi.lazyInit()
|
||||
return xi.info
|
||||
@ -32,7 +32,7 @@ func getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
||||
}
|
||||
|
||||
// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.
|
||||
func legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
||||
func legacyLoadExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
||||
if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {
|
||||
return xi.(*extensionFieldInfo)
|
||||
}
|
||||
@ -43,7 +43,7 @@ func legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {
|
||||
return e
|
||||
}
|
||||
|
||||
func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
|
||||
func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo {
|
||||
var wiretag uint64
|
||||
if !xd.IsPacked() {
|
||||
wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
|
||||
@ -59,10 +59,10 @@ func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
|
||||
// This is true for composite types, where we pass in a message, list, or map to fill in,
|
||||
// and for enums, where we pass in a prototype value to specify the concrete enum type.
|
||||
switch xd.Kind() {
|
||||
case pref.MessageKind, pref.GroupKind, pref.EnumKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind, protoreflect.EnumKind:
|
||||
e.unmarshalNeedsValue = true
|
||||
default:
|
||||
if xd.Cardinality() == pref.Repeated {
|
||||
if xd.Cardinality() == protoreflect.Repeated {
|
||||
e.unmarshalNeedsValue = true
|
||||
}
|
||||
}
|
||||
@ -73,21 +73,21 @@ type lazyExtensionValue struct {
|
||||
atomicOnce uint32 // atomically set if value is valid
|
||||
mu sync.Mutex
|
||||
xi *extensionFieldInfo
|
||||
value pref.Value
|
||||
value protoreflect.Value
|
||||
b []byte
|
||||
fn func() pref.Value
|
||||
fn func() protoreflect.Value
|
||||
}
|
||||
|
||||
type ExtensionField struct {
|
||||
typ pref.ExtensionType
|
||||
typ protoreflect.ExtensionType
|
||||
|
||||
// value is either the value of GetValue,
|
||||
// or a *lazyExtensionValue that then returns the value of GetValue.
|
||||
value pref.Value
|
||||
value protoreflect.Value
|
||||
lazy *lazyExtensionValue
|
||||
}
|
||||
|
||||
func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
|
||||
func (f *ExtensionField) appendLazyBytes(xt protoreflect.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
|
||||
if f.lazy == nil {
|
||||
f.lazy = &lazyExtensionValue{xi: xi}
|
||||
}
|
||||
@ -97,7 +97,7 @@ func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFie
|
||||
f.lazy.b = append(f.lazy.b, b...)
|
||||
}
|
||||
|
||||
func (f *ExtensionField) canLazy(xt pref.ExtensionType) bool {
|
||||
func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
|
||||
if f.typ == nil {
|
||||
return true
|
||||
}
|
||||
@ -154,7 +154,7 @@ func (f *ExtensionField) lazyInit() {
|
||||
|
||||
// Set sets the type and value of the extension field.
|
||||
// This must not be called concurrently.
|
||||
func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {
|
||||
func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value) {
|
||||
f.typ = t
|
||||
f.value = v
|
||||
f.lazy = nil
|
||||
@ -162,14 +162,14 @@ func (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {
|
||||
|
||||
// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
|
||||
// This must not be called concurrently.
|
||||
func (f *ExtensionField) SetLazy(t pref.ExtensionType, fn func() pref.Value) {
|
||||
func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) {
|
||||
f.typ = t
|
||||
f.lazy = &lazyExtensionValue{fn: fn}
|
||||
}
|
||||
|
||||
// Value returns the value of the extension field.
|
||||
// This may be called concurrently.
|
||||
func (f *ExtensionField) Value() pref.Value {
|
||||
func (f *ExtensionField) Value() protoreflect.Value {
|
||||
if f.lazy != nil {
|
||||
if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
|
||||
f.lazyInit()
|
||||
@ -181,7 +181,7 @@ func (f *ExtensionField) Value() pref.Value {
|
||||
|
||||
// Type returns the type of the extension field.
|
||||
// This may be called concurrently.
|
||||
func (f ExtensionField) Type() pref.ExtensionType {
|
||||
func (f ExtensionField) Type() protoreflect.ExtensionType {
|
||||
return f.typ
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ func (f ExtensionField) IsSet() bool {
|
||||
|
||||
// IsLazy reports whether a field is lazily encoded.
|
||||
// It is exported for testing.
|
||||
func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {
|
||||
func IsLazy(m protoreflect.Message, fd protoreflect.FieldDescriptor) bool {
|
||||
var mi *MessageInfo
|
||||
var p pointer
|
||||
switch m := m.(type) {
|
||||
@ -206,7 +206,7 @@ func IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {
|
||||
default:
|
||||
return false
|
||||
}
|
||||
xd, ok := fd.(pref.ExtensionTypeDescriptor)
|
||||
xd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
104
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
generated
vendored
104
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
generated
vendored
@ -10,16 +10,18 @@ import (
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
type errInvalidUTF8 struct{}
|
||||
|
||||
func (errInvalidUTF8) Error() string { return "string field contains invalid UTF-8" }
|
||||
func (errInvalidUTF8) InvalidUTF8() bool { return true }
|
||||
func (errInvalidUTF8) Unwrap() error { return errors.Error }
|
||||
|
||||
// initOneofFieldCoders initializes the fast-path functions for the fields in a oneof.
|
||||
//
|
||||
@ -28,7 +30,7 @@ func (errInvalidUTF8) InvalidUTF8() bool { return true }
|
||||
// to the appropriate field-specific function as necessary.
|
||||
//
|
||||
// The unmarshal function is set on each field individually as usual.
|
||||
func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structInfo) {
|
||||
func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si structInfo) {
|
||||
fs := si.oneofsByName[od.Name()]
|
||||
ft := fs.Type
|
||||
oneofFields := make(map[reflect.Type]*coderFieldInfo)
|
||||
@ -116,13 +118,13 @@ func (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structIn
|
||||
}
|
||||
}
|
||||
|
||||
func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {
|
||||
func makeWeakMessageFieldCoder(fd protoreflect.FieldDescriptor) pointerCoderFuncs {
|
||||
var once sync.Once
|
||||
var messageType pref.MessageType
|
||||
var messageType protoreflect.MessageType
|
||||
lazyInit := func() {
|
||||
once.Do(func() {
|
||||
messageName := fd.Message().FullName()
|
||||
messageType, _ = preg.GlobalTypes.FindMessageByName(messageName)
|
||||
messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||
})
|
||||
}
|
||||
|
||||
@ -188,7 +190,7 @@ func makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {
|
||||
}
|
||||
}
|
||||
|
||||
func makeMessageFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
func makeMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
if mi := getMessageInfo(ft); mi != nil {
|
||||
funcs := pointerCoderFuncs{
|
||||
size: sizeMessageInfo,
|
||||
@ -242,7 +244,7 @@ func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldI
|
||||
}
|
||||
v, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
if p.Elem().IsNil() {
|
||||
p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))
|
||||
@ -276,9 +278,9 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh
|
||||
}
|
||||
v, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
||||
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||
Buf: v,
|
||||
Message: m.ProtoReflect(),
|
||||
})
|
||||
@ -286,27 +288,27 @@ func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarsh
|
||||
return out, err
|
||||
}
|
||||
out.n = n
|
||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
||||
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func sizeMessageValue(v pref.Value, tagsize int, opts marshalOptions) int {
|
||||
func sizeMessageValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||
m := v.Message().Interface()
|
||||
return sizeMessage(m, tagsize, opts)
|
||||
}
|
||||
|
||||
func appendMessageValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
func appendMessageValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
m := v.Message().Interface()
|
||||
return appendMessage(b, m, wiretag, opts)
|
||||
}
|
||||
|
||||
func consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
|
||||
func consumeMessageValue(b []byte, v protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
|
||||
m := v.Message().Interface()
|
||||
out, err := consumeMessage(b, m, wtyp, opts)
|
||||
return v, out, err
|
||||
}
|
||||
|
||||
func isInitMessageValue(v pref.Value) error {
|
||||
func isInitMessageValue(v protoreflect.Value) error {
|
||||
m := v.Message().Interface()
|
||||
return proto.CheckInitialized(m)
|
||||
}
|
||||
@ -319,17 +321,17 @@ var coderMessageValue = valueCoderFuncs{
|
||||
merge: mergeMessageValue,
|
||||
}
|
||||
|
||||
func sizeGroupValue(v pref.Value, tagsize int, opts marshalOptions) int {
|
||||
func sizeGroupValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||
m := v.Message().Interface()
|
||||
return sizeGroup(m, tagsize, opts)
|
||||
}
|
||||
|
||||
func appendGroupValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
func appendGroupValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
m := v.Message().Interface()
|
||||
return appendGroup(b, m, wiretag, opts)
|
||||
}
|
||||
|
||||
func consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
|
||||
func consumeGroupValue(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
|
||||
m := v.Message().Interface()
|
||||
out, err := consumeGroup(b, m, num, wtyp, opts)
|
||||
return v, out, err
|
||||
@ -343,7 +345,7 @@ var coderGroupValue = valueCoderFuncs{
|
||||
merge: mergeMessageValue,
|
||||
}
|
||||
|
||||
func makeGroupFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
func makeGroupFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
num := fd.Number()
|
||||
if mi := getMessageInfo(ft); mi != nil {
|
||||
funcs := pointerCoderFuncs{
|
||||
@ -420,9 +422,9 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir
|
||||
}
|
||||
b, n := protowire.ConsumeGroup(num, b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
||||
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||
Buf: b,
|
||||
Message: m.ProtoReflect(),
|
||||
})
|
||||
@ -430,11 +432,11 @@ func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowir
|
||||
return out, err
|
||||
}
|
||||
out.n = n
|
||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
||||
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func makeMessageSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
func makeMessageSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
if mi := getMessageInfo(ft); mi != nil {
|
||||
funcs := pointerCoderFuncs{
|
||||
size: sizeMessageSliceInfo,
|
||||
@ -494,7 +496,7 @@ func consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderF
|
||||
}
|
||||
v, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
m := reflect.New(f.mi.GoReflectType.Elem()).Interface()
|
||||
mp := pointerOfIface(m)
|
||||
@ -550,10 +552,10 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir
|
||||
}
|
||||
v, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
mp := reflect.New(goType.Elem())
|
||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
||||
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||
Buf: v,
|
||||
Message: asMessage(mp).ProtoReflect(),
|
||||
})
|
||||
@ -562,7 +564,7 @@ func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowir
|
||||
}
|
||||
p.AppendPointerSlice(pointerOfValue(mp))
|
||||
out.n = n
|
||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
||||
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||
return out, nil
|
||||
}
|
||||
|
||||
@ -579,7 +581,7 @@ func isInitMessageSlice(p pointer, goType reflect.Type) error {
|
||||
|
||||
// Slices of messages
|
||||
|
||||
func sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {
|
||||
func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||
list := listv.List()
|
||||
n := 0
|
||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||
@ -589,7 +591,7 @@ func sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) i
|
||||
return n
|
||||
}
|
||||
|
||||
func appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
list := listv.List()
|
||||
mopts := opts.Options()
|
||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||
@ -606,30 +608,30 @@ func appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts ma
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
|
||||
func consumeMessageSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
|
||||
list := listv.List()
|
||||
if wtyp != protowire.BytesType {
|
||||
return pref.Value{}, out, errUnknown
|
||||
return protoreflect.Value{}, out, errUnknown
|
||||
}
|
||||
v, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return pref.Value{}, out, protowire.ParseError(n)
|
||||
return protoreflect.Value{}, out, errDecode
|
||||
}
|
||||
m := list.NewElement()
|
||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
||||
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||
Buf: v,
|
||||
Message: m.Message(),
|
||||
})
|
||||
if err != nil {
|
||||
return pref.Value{}, out, err
|
||||
return protoreflect.Value{}, out, err
|
||||
}
|
||||
list.Append(m)
|
||||
out.n = n
|
||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
||||
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||
return listv, out, nil
|
||||
}
|
||||
|
||||
func isInitMessageSliceValue(listv pref.Value) error {
|
||||
func isInitMessageSliceValue(listv protoreflect.Value) error {
|
||||
list := listv.List()
|
||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||
m := list.Get(i).Message().Interface()
|
||||
@ -648,7 +650,7 @@ var coderMessageSliceValue = valueCoderFuncs{
|
||||
merge: mergeMessageListValue,
|
||||
}
|
||||
|
||||
func sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {
|
||||
func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
|
||||
list := listv.List()
|
||||
n := 0
|
||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||
@ -658,7 +660,7 @@ func sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int
|
||||
return n
|
||||
}
|
||||
|
||||
func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
func appendGroupSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
|
||||
list := listv.List()
|
||||
mopts := opts.Options()
|
||||
for i, llen := 0, list.Len(); i < llen; i++ {
|
||||
@ -674,26 +676,26 @@ func appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts mars
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
|
||||
func consumeGroupSliceValue(b []byte, listv protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
|
||||
list := listv.List()
|
||||
if wtyp != protowire.StartGroupType {
|
||||
return pref.Value{}, out, errUnknown
|
||||
return protoreflect.Value{}, out, errUnknown
|
||||
}
|
||||
b, n := protowire.ConsumeGroup(num, b)
|
||||
if n < 0 {
|
||||
return pref.Value{}, out, protowire.ParseError(n)
|
||||
return protoreflect.Value{}, out, errDecode
|
||||
}
|
||||
m := list.NewElement()
|
||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
||||
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||
Buf: b,
|
||||
Message: m.Message(),
|
||||
})
|
||||
if err != nil {
|
||||
return pref.Value{}, out, err
|
||||
return protoreflect.Value{}, out, err
|
||||
}
|
||||
list.Append(m)
|
||||
out.n = n
|
||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
||||
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||
return listv, out, nil
|
||||
}
|
||||
|
||||
@ -705,7 +707,7 @@ var coderGroupSliceValue = valueCoderFuncs{
|
||||
merge: mergeMessageListValue,
|
||||
}
|
||||
|
||||
func makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
|
||||
num := fd.Number()
|
||||
if mi := getMessageInfo(ft); mi != nil {
|
||||
funcs := pointerCoderFuncs{
|
||||
@ -767,10 +769,10 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire
|
||||
}
|
||||
b, n := protowire.ConsumeGroup(num, b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
mp := reflect.New(goType.Elem())
|
||||
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
|
||||
o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
|
||||
Buf: b,
|
||||
Message: asMessage(mp).ProtoReflect(),
|
||||
})
|
||||
@ -779,7 +781,7 @@ func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire
|
||||
}
|
||||
p.AppendPointerSlice(pointerOfValue(mp))
|
||||
out.n = n
|
||||
out.initialized = o.Flags&piface.UnmarshalInitialized != 0
|
||||
out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
|
||||
return out, nil
|
||||
}
|
||||
|
||||
@ -820,8 +822,8 @@ func consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFie
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func asMessage(v reflect.Value) pref.ProtoMessage {
|
||||
if m, ok := v.Interface().(pref.ProtoMessage); ok {
|
||||
func asMessage(v reflect.Value) protoreflect.ProtoMessage {
|
||||
if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
|
||||
return m
|
||||
}
|
||||
return legacyWrapMessage(v).Interface()
|
||||
|
974
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
generated
vendored
974
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
generated
vendored
File diff suppressed because it is too large
Load Diff
39
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
generated
vendored
39
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
generated
vendored
@ -5,13 +5,12 @@
|
||||
package impl
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type mapInfo struct {
|
||||
@ -20,12 +19,12 @@ type mapInfo struct {
|
||||
valWiretag uint64
|
||||
keyFuncs valueCoderFuncs
|
||||
valFuncs valueCoderFuncs
|
||||
keyZero pref.Value
|
||||
keyKind pref.Kind
|
||||
keyZero protoreflect.Value
|
||||
keyKind protoreflect.Kind
|
||||
conv *mapConverter
|
||||
}
|
||||
|
||||
func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
|
||||
func encoderFuncsForMap(fd protoreflect.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
|
||||
// TODO: Consider generating specialized map coders.
|
||||
keyField := fd.MapKey()
|
||||
valField := fd.MapValue()
|
||||
@ -45,7 +44,7 @@ func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage
|
||||
keyKind: keyField.Kind(),
|
||||
conv: conv,
|
||||
}
|
||||
if valField.Kind() == pref.MessageKind {
|
||||
if valField.Kind() == protoreflect.MessageKind {
|
||||
valueMessage = getMessageInfo(ft.Elem())
|
||||
}
|
||||
|
||||
@ -69,9 +68,9 @@ func encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage
|
||||
},
|
||||
}
|
||||
switch valField.Kind() {
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
funcs.merge = mergeMapOfMessage
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
funcs.merge = mergeMapOfBytes
|
||||
default:
|
||||
funcs.merge = mergeMap
|
||||
@ -118,7 +117,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
||||
}
|
||||
b, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
var (
|
||||
key = mapi.keyZero
|
||||
@ -127,16 +126,16 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
||||
for len(b) > 0 {
|
||||
num, wtyp, n := protowire.ConsumeTag(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
if num > protowire.MaxValidNumber {
|
||||
return out, errors.New("invalid field number")
|
||||
return out, errDecode
|
||||
}
|
||||
b = b[n:]
|
||||
err := errUnknown
|
||||
switch num {
|
||||
case genid.MapEntry_Key_field_number:
|
||||
var v pref.Value
|
||||
var v protoreflect.Value
|
||||
var o unmarshalOutput
|
||||
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
||||
if err != nil {
|
||||
@ -145,7 +144,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
||||
key = v
|
||||
n = o.n
|
||||
case genid.MapEntry_Value_field_number:
|
||||
var v pref.Value
|
||||
var v protoreflect.Value
|
||||
var o unmarshalOutput
|
||||
v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)
|
||||
if err != nil {
|
||||
@ -157,7 +156,7 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo
|
||||
if err == errUnknown {
|
||||
n = protowire.ConsumeFieldValue(num, wtyp, b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
} else if err != nil {
|
||||
return out, err
|
||||
@ -175,7 +174,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi
|
||||
}
|
||||
b, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
var (
|
||||
key = mapi.keyZero
|
||||
@ -184,16 +183,16 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi
|
||||
for len(b) > 0 {
|
||||
num, wtyp, n := protowire.ConsumeTag(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
if num > protowire.MaxValidNumber {
|
||||
return out, errors.New("invalid field number")
|
||||
return out, errDecode
|
||||
}
|
||||
b = b[n:]
|
||||
err := errUnknown
|
||||
switch num {
|
||||
case 1:
|
||||
var v pref.Value
|
||||
var v protoreflect.Value
|
||||
var o unmarshalOutput
|
||||
v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
|
||||
if err != nil {
|
||||
@ -208,7 +207,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi
|
||||
var v []byte
|
||||
v, n = protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
var o unmarshalOutput
|
||||
o, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts)
|
||||
@ -221,7 +220,7 @@ func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi
|
||||
if err == errUnknown {
|
||||
n = protowire.ConsumeFieldValue(num, wtyp, b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
} else if err != nil {
|
||||
return out, err
|
||||
|
1
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
generated
vendored
1
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !go1.12
|
||||
// +build !go1.12
|
||||
|
||||
package impl
|
||||
|
1
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
generated
vendored
1
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.12
|
||||
// +build go1.12
|
||||
|
||||
package impl
|
||||
|
98
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_message.go
generated
vendored
98
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_message.go
generated
vendored
@ -11,22 +11,23 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/fieldsort"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/internal/order"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// coderMessageInfo contains per-message information used by the fast-path functions.
|
||||
// This is a different type from MessageInfo to keep MessageInfo as general-purpose as
|
||||
// possible.
|
||||
type coderMessageInfo struct {
|
||||
methods piface.Methods
|
||||
methods protoiface.Methods
|
||||
|
||||
orderedCoderFields []*coderFieldInfo
|
||||
denseCoderFields []*coderFieldInfo
|
||||
coderFields map[protowire.Number]*coderFieldInfo
|
||||
sizecacheOffset offset
|
||||
unknownOffset offset
|
||||
unknownPtrKind bool
|
||||
extensionOffset offset
|
||||
needsInitCheck bool
|
||||
isMessageSet bool
|
||||
@ -37,19 +38,30 @@ type coderFieldInfo struct {
|
||||
funcs pointerCoderFuncs // fast-path per-field functions
|
||||
mi *MessageInfo // field's message
|
||||
ft reflect.Type
|
||||
validation validationInfo // information used by message validation
|
||||
num pref.FieldNumber // field number
|
||||
offset offset // struct field offset
|
||||
wiretag uint64 // field tag (number + wire type)
|
||||
tagsize int // size of the varint-encoded tag
|
||||
isPointer bool // true if IsNil may be called on the struct field
|
||||
isRequired bool // true if field is required
|
||||
validation validationInfo // information used by message validation
|
||||
num protoreflect.FieldNumber // field number
|
||||
offset offset // struct field offset
|
||||
wiretag uint64 // field tag (number + wire type)
|
||||
tagsize int // size of the varint-encoded tag
|
||||
isPointer bool // true if IsNil may be called on the struct field
|
||||
isRequired bool // true if field is required
|
||||
}
|
||||
|
||||
func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||
mi.sizecacheOffset = si.sizecacheOffset
|
||||
mi.unknownOffset = si.unknownOffset
|
||||
mi.extensionOffset = si.extensionOffset
|
||||
mi.sizecacheOffset = invalidOffset
|
||||
mi.unknownOffset = invalidOffset
|
||||
mi.extensionOffset = invalidOffset
|
||||
|
||||
if si.sizecacheOffset.IsValid() && si.sizecacheType == sizecacheType {
|
||||
mi.sizecacheOffset = si.sizecacheOffset
|
||||
}
|
||||
if si.unknownOffset.IsValid() && (si.unknownType == unknownFieldsAType || si.unknownType == unknownFieldsBType) {
|
||||
mi.unknownOffset = si.unknownOffset
|
||||
mi.unknownPtrKind = si.unknownType.Kind() == reflect.Ptr
|
||||
}
|
||||
if si.extensionOffset.IsValid() && si.extensionType == extensionFieldsType {
|
||||
mi.extensionOffset = si.extensionOffset
|
||||
}
|
||||
|
||||
mi.coderFields = make(map[protowire.Number]*coderFieldInfo)
|
||||
fields := mi.Desc.Fields()
|
||||
@ -73,6 +85,27 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||
var funcs pointerCoderFuncs
|
||||
var childMessage *MessageInfo
|
||||
switch {
|
||||
case ft == nil:
|
||||
// This never occurs for generated message types.
|
||||
// It implies that a hand-crafted type has missing Go fields
|
||||
// for specific protobuf message fields.
|
||||
funcs = pointerCoderFuncs{
|
||||
size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
|
||||
return 0
|
||||
},
|
||||
marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
|
||||
return nil, nil
|
||||
},
|
||||
unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
isInit: func(p pointer, f *coderFieldInfo) error {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
merge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
}
|
||||
case isOneof:
|
||||
fieldOffset = offsetOf(fs, mi.Exporter)
|
||||
case fd.IsWeak():
|
||||
@ -92,8 +125,8 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||
funcs: funcs,
|
||||
mi: childMessage,
|
||||
validation: newFieldValidationInfo(mi, si, fd, ft),
|
||||
isPointer: fd.Cardinality() == pref.Repeated || fd.HasPresence(),
|
||||
isRequired: fd.Cardinality() == pref.Required,
|
||||
isPointer: fd.Cardinality() == protoreflect.Repeated || fd.HasPresence(),
|
||||
isRequired: fd.Cardinality() == protoreflect.Required,
|
||||
}
|
||||
mi.orderedCoderFields = append(mi.orderedCoderFields, cf)
|
||||
mi.coderFields[cf.num] = cf
|
||||
@ -116,7 +149,7 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||
return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num
|
||||
})
|
||||
|
||||
var maxDense pref.FieldNumber
|
||||
var maxDense protoreflect.FieldNumber
|
||||
for _, cf := range mi.orderedCoderFields {
|
||||
if cf.num >= 16 && cf.num >= 2*maxDense {
|
||||
break
|
||||
@ -136,18 +169,18 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||
sort.Slice(mi.orderedCoderFields, func(i, j int) bool {
|
||||
fi := fields.ByNumber(mi.orderedCoderFields[i].num)
|
||||
fj := fields.ByNumber(mi.orderedCoderFields[j].num)
|
||||
return fieldsort.Less(fi, fj)
|
||||
return order.LegacyFieldOrder(fi, fj)
|
||||
})
|
||||
}
|
||||
|
||||
mi.needsInitCheck = needsInitCheck(mi.Desc)
|
||||
if mi.methods.Marshal == nil && mi.methods.Size == nil {
|
||||
mi.methods.Flags |= piface.SupportMarshalDeterministic
|
||||
mi.methods.Flags |= protoiface.SupportMarshalDeterministic
|
||||
mi.methods.Marshal = mi.marshal
|
||||
mi.methods.Size = mi.size
|
||||
}
|
||||
if mi.methods.Unmarshal == nil {
|
||||
mi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown
|
||||
mi.methods.Flags |= protoiface.SupportUnmarshalDiscardUnknown
|
||||
mi.methods.Unmarshal = mi.unmarshal
|
||||
}
|
||||
if mi.methods.CheckInitialized == nil {
|
||||
@ -157,3 +190,28 @@ func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
|
||||
mi.methods.Merge = mi.merge
|
||||
}
|
||||
}
|
||||
|
||||
// getUnknownBytes returns a *[]byte for the unknown fields.
|
||||
// It is the caller's responsibility to check whether the pointer is nil.
|
||||
// This function is specially designed to be inlineable.
|
||||
func (mi *MessageInfo) getUnknownBytes(p pointer) *[]byte {
|
||||
if mi.unknownPtrKind {
|
||||
return *p.Apply(mi.unknownOffset).BytesPtr()
|
||||
} else {
|
||||
return p.Apply(mi.unknownOffset).Bytes()
|
||||
}
|
||||
}
|
||||
|
||||
// mutableUnknownBytes returns a *[]byte for the unknown fields.
|
||||
// The returned pointer is guaranteed to not be nil.
|
||||
func (mi *MessageInfo) mutableUnknownBytes(p pointer) *[]byte {
|
||||
if mi.unknownPtrKind {
|
||||
bp := p.Apply(mi.unknownOffset).BytesPtr()
|
||||
if *bp == nil {
|
||||
*bp = new([]byte)
|
||||
}
|
||||
return *bp
|
||||
} else {
|
||||
return p.Apply(mi.unknownOffset).Bytes()
|
||||
}
|
||||
}
|
||||
|
21
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
generated
vendored
21
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
generated
vendored
@ -29,8 +29,9 @@ func sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int)
|
||||
size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts)
|
||||
}
|
||||
|
||||
unknown := *p.Apply(mi.unknownOffset).Bytes()
|
||||
size += messageset.SizeUnknown(unknown)
|
||||
if u := mi.getUnknownBytes(p); u != nil {
|
||||
size += messageset.SizeUnknown(*u)
|
||||
}
|
||||
|
||||
return size
|
||||
}
|
||||
@ -69,10 +70,12 @@ func marshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts marshalOptions
|
||||
}
|
||||
}
|
||||
|
||||
unknown := *p.Apply(mi.unknownOffset).Bytes()
|
||||
b, err := messageset.AppendUnknown(b, unknown)
|
||||
if err != nil {
|
||||
return b, err
|
||||
if u := mi.getUnknownBytes(p); u != nil {
|
||||
var err error
|
||||
b, err = messageset.AppendUnknown(b, *u)
|
||||
if err != nil {
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
|
||||
return b, nil
|
||||
@ -100,13 +103,13 @@ func unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOpt
|
||||
*ep = make(map[int32]ExtensionField)
|
||||
}
|
||||
ext := *ep
|
||||
unknown := p.Apply(mi.unknownOffset).Bytes()
|
||||
initialized := true
|
||||
err = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error {
|
||||
o, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts)
|
||||
if err == errUnknown {
|
||||
*unknown = protowire.AppendTag(*unknown, num, protowire.BytesType)
|
||||
*unknown = append(*unknown, v...)
|
||||
u := mi.mutableUnknownBytes(p)
|
||||
*u = protowire.AppendTag(*u, num, protowire.BytesType)
|
||||
*u = append(*u, v...)
|
||||
return nil
|
||||
}
|
||||
if !o.initialized {
|
||||
|
9
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
generated
vendored
9
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// 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 impl
|
||||
@ -30,7 +31,7 @@ func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _
|
||||
}
|
||||
v, n := protowire.ConsumeVarint(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
p.v.Elem().SetInt(int64(v))
|
||||
out.n = n
|
||||
@ -130,12 +131,12 @@ func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf
|
||||
if wtyp == protowire.BytesType {
|
||||
b, n := protowire.ConsumeBytes(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
for len(b) > 0 {
|
||||
v, n := protowire.ConsumeVarint(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
rv := reflect.New(s.Type().Elem()).Elem()
|
||||
rv.SetInt(int64(v))
|
||||
@ -150,7 +151,7 @@ func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInf
|
||||
}
|
||||
v, n := protowire.ConsumeVarint(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
rv := reflect.New(s.Type().Elem()).Elem()
|
||||
rv.SetInt(int64(v))
|
||||
|
290
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
generated
vendored
290
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
generated
vendored
@ -10,7 +10,7 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// pointerCoderFuncs is a set of pointer encoding functions.
|
||||
@ -25,83 +25,83 @@ type pointerCoderFuncs struct {
|
||||
|
||||
// valueCoderFuncs is a set of protoreflect.Value encoding functions.
|
||||
type valueCoderFuncs struct {
|
||||
size func(v pref.Value, tagsize int, opts marshalOptions) int
|
||||
marshal func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
|
||||
unmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)
|
||||
isInit func(v pref.Value) error
|
||||
merge func(dst, src pref.Value, opts mergeOptions) pref.Value
|
||||
size func(v protoreflect.Value, tagsize int, opts marshalOptions) int
|
||||
marshal func(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
|
||||
unmarshal func(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error)
|
||||
isInit func(v protoreflect.Value) error
|
||||
merge func(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value
|
||||
}
|
||||
|
||||
// fieldCoder returns pointer functions for a field, used for operating on
|
||||
// struct fields.
|
||||
func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
|
||||
func fieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
|
||||
switch {
|
||||
case fd.IsMap():
|
||||
return encoderFuncsForMap(fd, ft)
|
||||
case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
|
||||
case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
|
||||
// Repeated fields (not packed).
|
||||
if ft.Kind() != reflect.Slice {
|
||||
break
|
||||
}
|
||||
ft := ft.Elem()
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if ft.Kind() == reflect.Bool {
|
||||
return nil, coderBoolSlice
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderEnumSlice
|
||||
}
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderInt32Slice
|
||||
}
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSint32Slice
|
||||
}
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderUint32Slice
|
||||
}
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderInt64Slice
|
||||
}
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSint64Slice
|
||||
}
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderUint64Slice
|
||||
}
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSfixed32Slice
|
||||
}
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderFixed32Slice
|
||||
}
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
if ft.Kind() == reflect.Float32 {
|
||||
return nil, coderFloatSlice
|
||||
}
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSfixed64Slice
|
||||
}
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderFixed64Slice
|
||||
}
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
if ft.Kind() == reflect.Float64 {
|
||||
return nil, coderDoubleSlice
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||
return nil, coderStringSliceValidateUTF8
|
||||
}
|
||||
@ -114,19 +114,19 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||
return nil, coderBytesSlice
|
||||
}
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
if ft.Kind() == reflect.String {
|
||||
return nil, coderStringSlice
|
||||
}
|
||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||
return nil, coderBytesSlice
|
||||
}
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)
|
||||
}
|
||||
case fd.Cardinality() == pref.Repeated && fd.IsPacked():
|
||||
case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
|
||||
// Packed repeated fields.
|
||||
//
|
||||
// Only repeated fields of primitive numeric types
|
||||
@ -136,128 +136,128 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||
}
|
||||
ft := ft.Elem()
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if ft.Kind() == reflect.Bool {
|
||||
return nil, coderBoolPackedSlice
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderEnumPackedSlice
|
||||
}
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderInt32PackedSlice
|
||||
}
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSint32PackedSlice
|
||||
}
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderUint32PackedSlice
|
||||
}
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderInt64PackedSlice
|
||||
}
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSint64PackedSlice
|
||||
}
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderUint64PackedSlice
|
||||
}
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSfixed32PackedSlice
|
||||
}
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderFixed32PackedSlice
|
||||
}
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
if ft.Kind() == reflect.Float32 {
|
||||
return nil, coderFloatPackedSlice
|
||||
}
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSfixed64PackedSlice
|
||||
}
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderFixed64PackedSlice
|
||||
}
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
if ft.Kind() == reflect.Float64 {
|
||||
return nil, coderDoublePackedSlice
|
||||
}
|
||||
}
|
||||
case fd.Kind() == pref.MessageKind:
|
||||
case fd.Kind() == protoreflect.MessageKind:
|
||||
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
||||
case fd.Kind() == pref.GroupKind:
|
||||
case fd.Kind() == protoreflect.GroupKind:
|
||||
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
||||
case fd.Syntax() == pref.Proto3 && fd.ContainingOneof() == nil:
|
||||
case fd.Syntax() == protoreflect.Proto3 && fd.ContainingOneof() == nil:
|
||||
// Populated oneof fields always encode even if set to the zero value,
|
||||
// which normally are not encoded in proto3.
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if ft.Kind() == reflect.Bool {
|
||||
return nil, coderBoolNoZero
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderEnumNoZero
|
||||
}
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderInt32NoZero
|
||||
}
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSint32NoZero
|
||||
}
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderUint32NoZero
|
||||
}
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderInt64NoZero
|
||||
}
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSint64NoZero
|
||||
}
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderUint64NoZero
|
||||
}
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSfixed32NoZero
|
||||
}
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderFixed32NoZero
|
||||
}
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
if ft.Kind() == reflect.Float32 {
|
||||
return nil, coderFloatNoZero
|
||||
}
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSfixed64NoZero
|
||||
}
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderFixed64NoZero
|
||||
}
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
if ft.Kind() == reflect.Float64 {
|
||||
return nil, coderDoubleNoZero
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||
return nil, coderStringNoZeroValidateUTF8
|
||||
}
|
||||
@ -270,7 +270,7 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||
return nil, coderBytesNoZero
|
||||
}
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
if ft.Kind() == reflect.String {
|
||||
return nil, coderStringNoZero
|
||||
}
|
||||
@ -281,133 +281,133 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||
case ft.Kind() == reflect.Ptr:
|
||||
ft := ft.Elem()
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if ft.Kind() == reflect.Bool {
|
||||
return nil, coderBoolPtr
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderEnumPtr
|
||||
}
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderInt32Ptr
|
||||
}
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSint32Ptr
|
||||
}
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderUint32Ptr
|
||||
}
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderInt64Ptr
|
||||
}
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSint64Ptr
|
||||
}
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderUint64Ptr
|
||||
}
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSfixed32Ptr
|
||||
}
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderFixed32Ptr
|
||||
}
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
if ft.Kind() == reflect.Float32 {
|
||||
return nil, coderFloatPtr
|
||||
}
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSfixed64Ptr
|
||||
}
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderFixed64Ptr
|
||||
}
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
if ft.Kind() == reflect.Float64 {
|
||||
return nil, coderDoublePtr
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||
return nil, coderStringPtrValidateUTF8
|
||||
}
|
||||
if ft.Kind() == reflect.String {
|
||||
return nil, coderStringPtr
|
||||
}
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
if ft.Kind() == reflect.String {
|
||||
return nil, coderStringPtr
|
||||
}
|
||||
}
|
||||
default:
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if ft.Kind() == reflect.Bool {
|
||||
return nil, coderBool
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderEnum
|
||||
}
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderInt32
|
||||
}
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSint32
|
||||
}
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderUint32
|
||||
}
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderInt64
|
||||
}
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSint64
|
||||
}
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderUint64
|
||||
}
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
if ft.Kind() == reflect.Int32 {
|
||||
return nil, coderSfixed32
|
||||
}
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
if ft.Kind() == reflect.Uint32 {
|
||||
return nil, coderFixed32
|
||||
}
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
if ft.Kind() == reflect.Float32 {
|
||||
return nil, coderFloat
|
||||
}
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
if ft.Kind() == reflect.Int64 {
|
||||
return nil, coderSfixed64
|
||||
}
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
if ft.Kind() == reflect.Uint64 {
|
||||
return nil, coderFixed64
|
||||
}
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
if ft.Kind() == reflect.Float64 {
|
||||
return nil, coderDouble
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
|
||||
return nil, coderStringValidateUTF8
|
||||
}
|
||||
@ -420,7 +420,7 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||
if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
|
||||
return nil, coderBytes
|
||||
}
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
if ft.Kind() == reflect.String {
|
||||
return nil, coderString
|
||||
}
|
||||
@ -434,122 +434,122 @@ func fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointer
|
||||
|
||||
// encoderFuncsForValue returns value functions for a field, used for
|
||||
// extension values and map encoding.
|
||||
func encoderFuncsForValue(fd pref.FieldDescriptor) valueCoderFuncs {
|
||||
func encoderFuncsForValue(fd protoreflect.FieldDescriptor) valueCoderFuncs {
|
||||
switch {
|
||||
case fd.Cardinality() == pref.Repeated && !fd.IsPacked():
|
||||
case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
return coderBoolSliceValue
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
return coderEnumSliceValue
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
return coderInt32SliceValue
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
return coderSint32SliceValue
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
return coderUint32SliceValue
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
return coderInt64SliceValue
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
return coderSint64SliceValue
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
return coderUint64SliceValue
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
return coderSfixed32SliceValue
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
return coderFixed32SliceValue
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
return coderFloatSliceValue
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
return coderSfixed64SliceValue
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
return coderFixed64SliceValue
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
return coderDoubleSliceValue
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
// We don't have a UTF-8 validating coder for repeated string fields.
|
||||
// Value coders are used for extensions and maps.
|
||||
// Extensions are never proto3, and maps never contain lists.
|
||||
return coderStringSliceValue
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
return coderBytesSliceValue
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
return coderMessageSliceValue
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
return coderGroupSliceValue
|
||||
}
|
||||
case fd.Cardinality() == pref.Repeated && fd.IsPacked():
|
||||
case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
return coderBoolPackedSliceValue
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
return coderEnumPackedSliceValue
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
return coderInt32PackedSliceValue
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
return coderSint32PackedSliceValue
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
return coderUint32PackedSliceValue
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
return coderInt64PackedSliceValue
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
return coderSint64PackedSliceValue
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
return coderUint64PackedSliceValue
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
return coderSfixed32PackedSliceValue
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
return coderFixed32PackedSliceValue
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
return coderFloatPackedSliceValue
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
return coderSfixed64PackedSliceValue
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
return coderFixed64PackedSliceValue
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
return coderDoublePackedSliceValue
|
||||
}
|
||||
default:
|
||||
switch fd.Kind() {
|
||||
default:
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
return coderBoolValue
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
return coderEnumValue
|
||||
case pref.Int32Kind:
|
||||
case protoreflect.Int32Kind:
|
||||
return coderInt32Value
|
||||
case pref.Sint32Kind:
|
||||
case protoreflect.Sint32Kind:
|
||||
return coderSint32Value
|
||||
case pref.Uint32Kind:
|
||||
case protoreflect.Uint32Kind:
|
||||
return coderUint32Value
|
||||
case pref.Int64Kind:
|
||||
case protoreflect.Int64Kind:
|
||||
return coderInt64Value
|
||||
case pref.Sint64Kind:
|
||||
case protoreflect.Sint64Kind:
|
||||
return coderSint64Value
|
||||
case pref.Uint64Kind:
|
||||
case protoreflect.Uint64Kind:
|
||||
return coderUint64Value
|
||||
case pref.Sfixed32Kind:
|
||||
case protoreflect.Sfixed32Kind:
|
||||
return coderSfixed32Value
|
||||
case pref.Fixed32Kind:
|
||||
case protoreflect.Fixed32Kind:
|
||||
return coderFixed32Value
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
return coderFloatValue
|
||||
case pref.Sfixed64Kind:
|
||||
case protoreflect.Sfixed64Kind:
|
||||
return coderSfixed64Value
|
||||
case pref.Fixed64Kind:
|
||||
case protoreflect.Fixed64Kind:
|
||||
return coderFixed64Value
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
return coderDoubleValue
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if strs.EnforceUTF8(fd) {
|
||||
return coderStringValueValidateUTF8
|
||||
}
|
||||
return coderStringValue
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
return coderBytesValue
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
return coderMessageValue
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
return coderGroupValue
|
||||
}
|
||||
}
|
||||
|
1
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
generated
vendored
1
actions/retest/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// 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 impl
|
||||
|
257
actions/retest/vendor/google.golang.org/protobuf/internal/impl/convert.go
generated
vendored
257
actions/retest/vendor/google.golang.org/protobuf/internal/impl/convert.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// unwrapper unwraps the value to the underlying value.
|
||||
@ -20,13 +20,13 @@ type unwrapper interface {
|
||||
// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
|
||||
type Converter interface {
|
||||
// PBValueOf converts a reflect.Value to a protoreflect.Value.
|
||||
PBValueOf(reflect.Value) pref.Value
|
||||
PBValueOf(reflect.Value) protoreflect.Value
|
||||
|
||||
// GoValueOf converts a protoreflect.Value to a reflect.Value.
|
||||
GoValueOf(pref.Value) reflect.Value
|
||||
GoValueOf(protoreflect.Value) reflect.Value
|
||||
|
||||
// IsValidPB returns whether a protoreflect.Value is compatible with this type.
|
||||
IsValidPB(pref.Value) bool
|
||||
IsValidPB(protoreflect.Value) bool
|
||||
|
||||
// IsValidGo returns whether a reflect.Value is compatible with this type.
|
||||
IsValidGo(reflect.Value) bool
|
||||
@ -34,12 +34,12 @@ type Converter interface {
|
||||
// New returns a new field value.
|
||||
// For scalars, it returns the default value of the field.
|
||||
// For composite types, it returns a new mutable value.
|
||||
New() pref.Value
|
||||
New() protoreflect.Value
|
||||
|
||||
// Zero returns a new field value.
|
||||
// For scalars, it returns the default value of the field.
|
||||
// For composite types, it returns an immutable, empty value.
|
||||
Zero() pref.Value
|
||||
Zero() protoreflect.Value
|
||||
}
|
||||
|
||||
// NewConverter matches a Go type with a protobuf field and returns a Converter
|
||||
@ -50,7 +50,7 @@ type Converter interface {
|
||||
// This matcher deliberately supports a wider range of Go types than what
|
||||
// protoc-gen-go historically generated to be able to automatically wrap some
|
||||
// v1 messages generated by other forks of protoc-gen-go.
|
||||
func NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||
func NewConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||
switch {
|
||||
case fd.IsList():
|
||||
return newListConverter(t, fd)
|
||||
@ -76,68 +76,68 @@ var (
|
||||
)
|
||||
|
||||
var (
|
||||
boolZero = pref.ValueOfBool(false)
|
||||
int32Zero = pref.ValueOfInt32(0)
|
||||
int64Zero = pref.ValueOfInt64(0)
|
||||
uint32Zero = pref.ValueOfUint32(0)
|
||||
uint64Zero = pref.ValueOfUint64(0)
|
||||
float32Zero = pref.ValueOfFloat32(0)
|
||||
float64Zero = pref.ValueOfFloat64(0)
|
||||
stringZero = pref.ValueOfString("")
|
||||
bytesZero = pref.ValueOfBytes(nil)
|
||||
boolZero = protoreflect.ValueOfBool(false)
|
||||
int32Zero = protoreflect.ValueOfInt32(0)
|
||||
int64Zero = protoreflect.ValueOfInt64(0)
|
||||
uint32Zero = protoreflect.ValueOfUint32(0)
|
||||
uint64Zero = protoreflect.ValueOfUint64(0)
|
||||
float32Zero = protoreflect.ValueOfFloat32(0)
|
||||
float64Zero = protoreflect.ValueOfFloat64(0)
|
||||
stringZero = protoreflect.ValueOfString("")
|
||||
bytesZero = protoreflect.ValueOfBytes(nil)
|
||||
)
|
||||
|
||||
func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||
defVal := func(fd pref.FieldDescriptor, zero pref.Value) pref.Value {
|
||||
if fd.Cardinality() == pref.Repeated {
|
||||
func newSingularConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||
defVal := func(fd protoreflect.FieldDescriptor, zero protoreflect.Value) protoreflect.Value {
|
||||
if fd.Cardinality() == protoreflect.Repeated {
|
||||
// Default isn't defined for repeated fields.
|
||||
return zero
|
||||
}
|
||||
return fd.Default()
|
||||
}
|
||||
switch fd.Kind() {
|
||||
case pref.BoolKind:
|
||||
case protoreflect.BoolKind:
|
||||
if t.Kind() == reflect.Bool {
|
||||
return &boolConverter{t, defVal(fd, boolZero)}
|
||||
}
|
||||
case pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
|
||||
if t.Kind() == reflect.Int32 {
|
||||
return &int32Converter{t, defVal(fd, int32Zero)}
|
||||
}
|
||||
case pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:
|
||||
case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
if t.Kind() == reflect.Int64 {
|
||||
return &int64Converter{t, defVal(fd, int64Zero)}
|
||||
}
|
||||
case pref.Uint32Kind, pref.Fixed32Kind:
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
|
||||
if t.Kind() == reflect.Uint32 {
|
||||
return &uint32Converter{t, defVal(fd, uint32Zero)}
|
||||
}
|
||||
case pref.Uint64Kind, pref.Fixed64Kind:
|
||||
case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
if t.Kind() == reflect.Uint64 {
|
||||
return &uint64Converter{t, defVal(fd, uint64Zero)}
|
||||
}
|
||||
case pref.FloatKind:
|
||||
case protoreflect.FloatKind:
|
||||
if t.Kind() == reflect.Float32 {
|
||||
return &float32Converter{t, defVal(fd, float32Zero)}
|
||||
}
|
||||
case pref.DoubleKind:
|
||||
case protoreflect.DoubleKind:
|
||||
if t.Kind() == reflect.Float64 {
|
||||
return &float64Converter{t, defVal(fd, float64Zero)}
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
||||
return &stringConverter{t, defVal(fd, stringZero)}
|
||||
}
|
||||
case pref.BytesKind:
|
||||
case protoreflect.BytesKind:
|
||||
if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
|
||||
return &bytesConverter{t, defVal(fd, bytesZero)}
|
||||
}
|
||||
case pref.EnumKind:
|
||||
case protoreflect.EnumKind:
|
||||
// Handle enums, which must be a named int32 type.
|
||||
if t.Kind() == reflect.Int32 {
|
||||
return newEnumConverter(t, fd)
|
||||
}
|
||||
case pref.MessageKind, pref.GroupKind:
|
||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||
return newMessageConverter(t)
|
||||
}
|
||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
||||
@ -145,184 +145,184 @@ func newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||
|
||||
type boolConverter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *boolConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *boolConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfBool(v.Bool())
|
||||
return protoreflect.ValueOfBool(v.Bool())
|
||||
}
|
||||
func (c *boolConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *boolConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(v.Bool()).Convert(c.goType)
|
||||
}
|
||||
func (c *boolConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *boolConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(bool)
|
||||
return ok
|
||||
}
|
||||
func (c *boolConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *boolConverter) New() pref.Value { return c.def }
|
||||
func (c *boolConverter) Zero() pref.Value { return c.def }
|
||||
func (c *boolConverter) New() protoreflect.Value { return c.def }
|
||||
func (c *boolConverter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type int32Converter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *int32Converter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *int32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfInt32(int32(v.Int()))
|
||||
return protoreflect.ValueOfInt32(int32(v.Int()))
|
||||
}
|
||||
func (c *int32Converter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *int32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(int32(v.Int())).Convert(c.goType)
|
||||
}
|
||||
func (c *int32Converter) IsValidPB(v pref.Value) bool {
|
||||
func (c *int32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(int32)
|
||||
return ok
|
||||
}
|
||||
func (c *int32Converter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *int32Converter) New() pref.Value { return c.def }
|
||||
func (c *int32Converter) Zero() pref.Value { return c.def }
|
||||
func (c *int32Converter) New() protoreflect.Value { return c.def }
|
||||
func (c *int32Converter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type int64Converter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *int64Converter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *int64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfInt64(int64(v.Int()))
|
||||
return protoreflect.ValueOfInt64(int64(v.Int()))
|
||||
}
|
||||
func (c *int64Converter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *int64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(int64(v.Int())).Convert(c.goType)
|
||||
}
|
||||
func (c *int64Converter) IsValidPB(v pref.Value) bool {
|
||||
func (c *int64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(int64)
|
||||
return ok
|
||||
}
|
||||
func (c *int64Converter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *int64Converter) New() pref.Value { return c.def }
|
||||
func (c *int64Converter) Zero() pref.Value { return c.def }
|
||||
func (c *int64Converter) New() protoreflect.Value { return c.def }
|
||||
func (c *int64Converter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type uint32Converter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *uint32Converter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *uint32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfUint32(uint32(v.Uint()))
|
||||
return protoreflect.ValueOfUint32(uint32(v.Uint()))
|
||||
}
|
||||
func (c *uint32Converter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *uint32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)
|
||||
}
|
||||
func (c *uint32Converter) IsValidPB(v pref.Value) bool {
|
||||
func (c *uint32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(uint32)
|
||||
return ok
|
||||
}
|
||||
func (c *uint32Converter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *uint32Converter) New() pref.Value { return c.def }
|
||||
func (c *uint32Converter) Zero() pref.Value { return c.def }
|
||||
func (c *uint32Converter) New() protoreflect.Value { return c.def }
|
||||
func (c *uint32Converter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type uint64Converter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *uint64Converter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *uint64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfUint64(uint64(v.Uint()))
|
||||
return protoreflect.ValueOfUint64(uint64(v.Uint()))
|
||||
}
|
||||
func (c *uint64Converter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *uint64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)
|
||||
}
|
||||
func (c *uint64Converter) IsValidPB(v pref.Value) bool {
|
||||
func (c *uint64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(uint64)
|
||||
return ok
|
||||
}
|
||||
func (c *uint64Converter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *uint64Converter) New() pref.Value { return c.def }
|
||||
func (c *uint64Converter) Zero() pref.Value { return c.def }
|
||||
func (c *uint64Converter) New() protoreflect.Value { return c.def }
|
||||
func (c *uint64Converter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type float32Converter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *float32Converter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *float32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfFloat32(float32(v.Float()))
|
||||
return protoreflect.ValueOfFloat32(float32(v.Float()))
|
||||
}
|
||||
func (c *float32Converter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *float32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(float32(v.Float())).Convert(c.goType)
|
||||
}
|
||||
func (c *float32Converter) IsValidPB(v pref.Value) bool {
|
||||
func (c *float32Converter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(float32)
|
||||
return ok
|
||||
}
|
||||
func (c *float32Converter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *float32Converter) New() pref.Value { return c.def }
|
||||
func (c *float32Converter) Zero() pref.Value { return c.def }
|
||||
func (c *float32Converter) New() protoreflect.Value { return c.def }
|
||||
func (c *float32Converter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type float64Converter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *float64Converter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *float64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfFloat64(float64(v.Float()))
|
||||
return protoreflect.ValueOfFloat64(float64(v.Float()))
|
||||
}
|
||||
func (c *float64Converter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *float64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(float64(v.Float())).Convert(c.goType)
|
||||
}
|
||||
func (c *float64Converter) IsValidPB(v pref.Value) bool {
|
||||
func (c *float64Converter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(float64)
|
||||
return ok
|
||||
}
|
||||
func (c *float64Converter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *float64Converter) New() pref.Value { return c.def }
|
||||
func (c *float64Converter) Zero() pref.Value { return c.def }
|
||||
func (c *float64Converter) New() protoreflect.Value { return c.def }
|
||||
func (c *float64Converter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type stringConverter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *stringConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *stringConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfString(v.Convert(stringType).String())
|
||||
return protoreflect.ValueOfString(v.Convert(stringType).String())
|
||||
}
|
||||
func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *stringConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
// pref.Value.String never panics, so we go through an interface
|
||||
// conversion here to check the type.
|
||||
s := v.Interface().(string)
|
||||
@ -331,71 +331,71 @@ func (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
}
|
||||
return reflect.ValueOf(s).Convert(c.goType)
|
||||
}
|
||||
func (c *stringConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *stringConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(string)
|
||||
return ok
|
||||
}
|
||||
func (c *stringConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *stringConverter) New() pref.Value { return c.def }
|
||||
func (c *stringConverter) Zero() pref.Value { return c.def }
|
||||
func (c *stringConverter) New() protoreflect.Value { return c.def }
|
||||
func (c *stringConverter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type bytesConverter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func (c *bytesConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *bytesConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
if c.goType.Kind() == reflect.String && v.Len() == 0 {
|
||||
return pref.ValueOfBytes(nil) // ensure empty string is []byte(nil)
|
||||
return protoreflect.ValueOfBytes(nil) // ensure empty string is []byte(nil)
|
||||
}
|
||||
return pref.ValueOfBytes(v.Convert(bytesType).Bytes())
|
||||
return protoreflect.ValueOfBytes(v.Convert(bytesType).Bytes())
|
||||
}
|
||||
func (c *bytesConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *bytesConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(v.Bytes()).Convert(c.goType)
|
||||
}
|
||||
func (c *bytesConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *bytesConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().([]byte)
|
||||
return ok
|
||||
}
|
||||
func (c *bytesConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
func (c *bytesConverter) New() pref.Value { return c.def }
|
||||
func (c *bytesConverter) Zero() pref.Value { return c.def }
|
||||
func (c *bytesConverter) New() protoreflect.Value { return c.def }
|
||||
func (c *bytesConverter) Zero() protoreflect.Value { return c.def }
|
||||
|
||||
type enumConverter struct {
|
||||
goType reflect.Type
|
||||
def pref.Value
|
||||
def protoreflect.Value
|
||||
}
|
||||
|
||||
func newEnumConverter(goType reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||
var def pref.Value
|
||||
if fd.Cardinality() == pref.Repeated {
|
||||
def = pref.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
||||
func newEnumConverter(goType reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||
var def protoreflect.Value
|
||||
if fd.Cardinality() == protoreflect.Repeated {
|
||||
def = protoreflect.ValueOfEnum(fd.Enum().Values().Get(0).Number())
|
||||
} else {
|
||||
def = fd.Default()
|
||||
}
|
||||
return &enumConverter{goType, def}
|
||||
}
|
||||
|
||||
func (c *enumConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *enumConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfEnum(pref.EnumNumber(v.Int()))
|
||||
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v.Int()))
|
||||
}
|
||||
|
||||
func (c *enumConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *enumConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return reflect.ValueOf(v.Enum()).Convert(c.goType)
|
||||
}
|
||||
|
||||
func (c *enumConverter) IsValidPB(v pref.Value) bool {
|
||||
_, ok := v.Interface().(pref.EnumNumber)
|
||||
func (c *enumConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
_, ok := v.Interface().(protoreflect.EnumNumber)
|
||||
return ok
|
||||
}
|
||||
|
||||
@ -403,11 +403,11 @@ func (c *enumConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
|
||||
func (c *enumConverter) New() pref.Value {
|
||||
func (c *enumConverter) New() protoreflect.Value {
|
||||
return c.def
|
||||
}
|
||||
|
||||
func (c *enumConverter) Zero() pref.Value {
|
||||
func (c *enumConverter) Zero() protoreflect.Value {
|
||||
return c.def
|
||||
}
|
||||
|
||||
@ -419,17 +419,24 @@ func newMessageConverter(goType reflect.Type) Converter {
|
||||
return &messageConverter{goType}
|
||||
}
|
||||
|
||||
func (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *messageConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
if m, ok := v.Interface().(pref.ProtoMessage); ok {
|
||||
return pref.ValueOfMessage(m.ProtoReflect())
|
||||
if c.isNonPointer() {
|
||||
if v.CanAddr() {
|
||||
v = v.Addr() // T => *T
|
||||
} else {
|
||||
v = reflect.Zero(reflect.PtrTo(v.Type()))
|
||||
}
|
||||
}
|
||||
return pref.ValueOfMessage(legacyWrapMessage(v))
|
||||
if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
}
|
||||
return protoreflect.ValueOfMessage(legacyWrapMessage(v))
|
||||
}
|
||||
|
||||
func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *messageConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
m := v.Message()
|
||||
var rv reflect.Value
|
||||
if u, ok := m.(unwrapper); ok {
|
||||
@ -437,13 +444,23 @@ func (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
} else {
|
||||
rv = reflect.ValueOf(m.Interface())
|
||||
}
|
||||
if c.isNonPointer() {
|
||||
if rv.Type() != reflect.PtrTo(c.goType) {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), reflect.PtrTo(c.goType)))
|
||||
}
|
||||
if !rv.IsNil() {
|
||||
rv = rv.Elem() // *T => T
|
||||
} else {
|
||||
rv = reflect.Zero(rv.Type().Elem())
|
||||
}
|
||||
}
|
||||
if rv.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), c.goType))
|
||||
}
|
||||
return rv
|
||||
}
|
||||
|
||||
func (c *messageConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *messageConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
m := v.Message()
|
||||
var rv reflect.Value
|
||||
if u, ok := m.(unwrapper); ok {
|
||||
@ -451,6 +468,9 @@ func (c *messageConverter) IsValidPB(v pref.Value) bool {
|
||||
} else {
|
||||
rv = reflect.ValueOf(m.Interface())
|
||||
}
|
||||
if c.isNonPointer() {
|
||||
return rv.Type() == reflect.PtrTo(c.goType)
|
||||
}
|
||||
return rv.Type() == c.goType
|
||||
}
|
||||
|
||||
@ -458,10 +478,19 @@ func (c *messageConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
|
||||
func (c *messageConverter) New() pref.Value {
|
||||
func (c *messageConverter) New() protoreflect.Value {
|
||||
if c.isNonPointer() {
|
||||
return c.PBValueOf(reflect.New(c.goType).Elem())
|
||||
}
|
||||
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
||||
}
|
||||
|
||||
func (c *messageConverter) Zero() pref.Value {
|
||||
func (c *messageConverter) Zero() protoreflect.Value {
|
||||
return c.PBValueOf(reflect.Zero(c.goType))
|
||||
}
|
||||
|
||||
// isNonPointer reports whether the type is a non-pointer type.
|
||||
// This never occurs for generated message types.
|
||||
func (c *messageConverter) isNonPointer() bool {
|
||||
return c.goType.Kind() != reflect.Ptr
|
||||
}
|
||||
|
42
actions/retest/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
generated
vendored
42
actions/retest/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
generated
vendored
@ -8,10 +8,10 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
func newListConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {
|
||||
func newListConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
|
||||
switch {
|
||||
case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:
|
||||
return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}
|
||||
@ -26,16 +26,16 @@ type listConverter struct {
|
||||
c Converter
|
||||
}
|
||||
|
||||
func (c *listConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *listConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
pv := reflect.New(c.goType)
|
||||
pv.Elem().Set(v)
|
||||
return pref.ValueOfList(&listReflect{pv, c.c})
|
||||
return protoreflect.ValueOfList(&listReflect{pv, c.c})
|
||||
}
|
||||
|
||||
func (c *listConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *listConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
rv := v.List().(*listReflect).v
|
||||
if rv.IsNil() {
|
||||
return reflect.Zero(c.goType)
|
||||
@ -43,7 +43,7 @@ func (c *listConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
return rv.Elem()
|
||||
}
|
||||
|
||||
func (c *listConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *listConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
list, ok := v.Interface().(*listReflect)
|
||||
if !ok {
|
||||
return false
|
||||
@ -55,12 +55,12 @@ func (c *listConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
|
||||
func (c *listConverter) New() pref.Value {
|
||||
return pref.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
|
||||
func (c *listConverter) New() protoreflect.Value {
|
||||
return protoreflect.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
|
||||
}
|
||||
|
||||
func (c *listConverter) Zero() pref.Value {
|
||||
return pref.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
|
||||
func (c *listConverter) Zero() protoreflect.Value {
|
||||
return protoreflect.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
|
||||
}
|
||||
|
||||
type listPtrConverter struct {
|
||||
@ -68,18 +68,18 @@ type listPtrConverter struct {
|
||||
c Converter
|
||||
}
|
||||
|
||||
func (c *listPtrConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *listPtrConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfList(&listReflect{v, c.c})
|
||||
return protoreflect.ValueOfList(&listReflect{v, c.c})
|
||||
}
|
||||
|
||||
func (c *listPtrConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *listPtrConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return v.List().(*listReflect).v
|
||||
}
|
||||
|
||||
func (c *listPtrConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *listPtrConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
list, ok := v.Interface().(*listReflect)
|
||||
if !ok {
|
||||
return false
|
||||
@ -91,11 +91,11 @@ func (c *listPtrConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
|
||||
func (c *listPtrConverter) New() pref.Value {
|
||||
func (c *listPtrConverter) New() protoreflect.Value {
|
||||
return c.PBValueOf(reflect.New(c.goType.Elem()))
|
||||
}
|
||||
|
||||
func (c *listPtrConverter) Zero() pref.Value {
|
||||
func (c *listPtrConverter) Zero() protoreflect.Value {
|
||||
return c.PBValueOf(reflect.Zero(c.goType))
|
||||
}
|
||||
|
||||
@ -110,16 +110,16 @@ func (ls *listReflect) Len() int {
|
||||
}
|
||||
return ls.v.Elem().Len()
|
||||
}
|
||||
func (ls *listReflect) Get(i int) pref.Value {
|
||||
func (ls *listReflect) Get(i int) protoreflect.Value {
|
||||
return ls.conv.PBValueOf(ls.v.Elem().Index(i))
|
||||
}
|
||||
func (ls *listReflect) Set(i int, v pref.Value) {
|
||||
func (ls *listReflect) Set(i int, v protoreflect.Value) {
|
||||
ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))
|
||||
}
|
||||
func (ls *listReflect) Append(v pref.Value) {
|
||||
func (ls *listReflect) Append(v protoreflect.Value) {
|
||||
ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))
|
||||
}
|
||||
func (ls *listReflect) AppendMutable() pref.Value {
|
||||
func (ls *listReflect) AppendMutable() protoreflect.Value {
|
||||
if _, ok := ls.conv.(*messageConverter); !ok {
|
||||
panic("invalid AppendMutable on list with non-message type")
|
||||
}
|
||||
@ -130,7 +130,7 @@ func (ls *listReflect) AppendMutable() pref.Value {
|
||||
func (ls *listReflect) Truncate(i int) {
|
||||
ls.v.Elem().Set(ls.v.Elem().Slice(0, i))
|
||||
}
|
||||
func (ls *listReflect) NewElement() pref.Value {
|
||||
func (ls *listReflect) NewElement() protoreflect.Value {
|
||||
return ls.conv.New()
|
||||
}
|
||||
func (ls *listReflect) IsValid() bool {
|
||||
|
32
actions/retest/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
generated
vendored
32
actions/retest/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type mapConverter struct {
|
||||
@ -16,7 +16,7 @@ type mapConverter struct {
|
||||
keyConv, valConv Converter
|
||||
}
|
||||
|
||||
func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {
|
||||
func newMapConverter(t reflect.Type, fd protoreflect.FieldDescriptor) *mapConverter {
|
||||
if t.Kind() != reflect.Map {
|
||||
panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
|
||||
}
|
||||
@ -27,18 +27,18 @@ func newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *mapConverter) PBValueOf(v reflect.Value) pref.Value {
|
||||
func (c *mapConverter) PBValueOf(v reflect.Value) protoreflect.Value {
|
||||
if v.Type() != c.goType {
|
||||
panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
|
||||
}
|
||||
return pref.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
|
||||
return protoreflect.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
|
||||
}
|
||||
|
||||
func (c *mapConverter) GoValueOf(v pref.Value) reflect.Value {
|
||||
func (c *mapConverter) GoValueOf(v protoreflect.Value) reflect.Value {
|
||||
return v.Map().(*mapReflect).v
|
||||
}
|
||||
|
||||
func (c *mapConverter) IsValidPB(v pref.Value) bool {
|
||||
func (c *mapConverter) IsValidPB(v protoreflect.Value) bool {
|
||||
mapv, ok := v.Interface().(*mapReflect)
|
||||
if !ok {
|
||||
return false
|
||||
@ -50,11 +50,11 @@ func (c *mapConverter) IsValidGo(v reflect.Value) bool {
|
||||
return v.IsValid() && v.Type() == c.goType
|
||||
}
|
||||
|
||||
func (c *mapConverter) New() pref.Value {
|
||||
func (c *mapConverter) New() protoreflect.Value {
|
||||
return c.PBValueOf(reflect.MakeMap(c.goType))
|
||||
}
|
||||
|
||||
func (c *mapConverter) Zero() pref.Value {
|
||||
func (c *mapConverter) Zero() protoreflect.Value {
|
||||
return c.PBValueOf(reflect.Zero(c.goType))
|
||||
}
|
||||
|
||||
@ -67,29 +67,29 @@ type mapReflect struct {
|
||||
func (ms *mapReflect) Len() int {
|
||||
return ms.v.Len()
|
||||
}
|
||||
func (ms *mapReflect) Has(k pref.MapKey) bool {
|
||||
func (ms *mapReflect) Has(k protoreflect.MapKey) bool {
|
||||
rk := ms.keyConv.GoValueOf(k.Value())
|
||||
rv := ms.v.MapIndex(rk)
|
||||
return rv.IsValid()
|
||||
}
|
||||
func (ms *mapReflect) Get(k pref.MapKey) pref.Value {
|
||||
func (ms *mapReflect) Get(k protoreflect.MapKey) protoreflect.Value {
|
||||
rk := ms.keyConv.GoValueOf(k.Value())
|
||||
rv := ms.v.MapIndex(rk)
|
||||
if !rv.IsValid() {
|
||||
return pref.Value{}
|
||||
return protoreflect.Value{}
|
||||
}
|
||||
return ms.valConv.PBValueOf(rv)
|
||||
}
|
||||
func (ms *mapReflect) Set(k pref.MapKey, v pref.Value) {
|
||||
func (ms *mapReflect) Set(k protoreflect.MapKey, v protoreflect.Value) {
|
||||
rk := ms.keyConv.GoValueOf(k.Value())
|
||||
rv := ms.valConv.GoValueOf(v)
|
||||
ms.v.SetMapIndex(rk, rv)
|
||||
}
|
||||
func (ms *mapReflect) Clear(k pref.MapKey) {
|
||||
func (ms *mapReflect) Clear(k protoreflect.MapKey) {
|
||||
rk := ms.keyConv.GoValueOf(k.Value())
|
||||
ms.v.SetMapIndex(rk, reflect.Value{})
|
||||
}
|
||||
func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {
|
||||
func (ms *mapReflect) Mutable(k protoreflect.MapKey) protoreflect.Value {
|
||||
if _, ok := ms.valConv.(*messageConverter); !ok {
|
||||
panic("invalid Mutable on map with non-message value type")
|
||||
}
|
||||
@ -100,7 +100,7 @@ func (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {
|
||||
}
|
||||
return v
|
||||
}
|
||||
func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {
|
||||
func (ms *mapReflect) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
|
||||
iter := mapRange(ms.v)
|
||||
for iter.Next() {
|
||||
k := ms.keyConv.PBValueOf(iter.Key()).MapKey()
|
||||
@ -110,7 +110,7 @@ func (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {
|
||||
}
|
||||
}
|
||||
}
|
||||
func (ms *mapReflect) NewValue() pref.Value {
|
||||
func (ms *mapReflect) NewValue() protoreflect.Value {
|
||||
return ms.valConv.New()
|
||||
}
|
||||
func (ms *mapReflect) IsValid() bool {
|
||||
|
45
actions/retest/vendor/google.golang.org/protobuf/internal/impl/decode.go
generated
vendored
45
actions/retest/vendor/google.golang.org/protobuf/internal/impl/decode.go
generated
vendored
@ -12,17 +12,20 @@ import (
|
||||
"google.golang.org/protobuf/internal/flags"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
var errDecode = errors.New("cannot parse invalid wire-format data")
|
||||
var errRecursionDepth = errors.New("exceeded maximum recursion depth")
|
||||
|
||||
type unmarshalOptions struct {
|
||||
flags protoiface.UnmarshalInputFlags
|
||||
resolver interface {
|
||||
FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
|
||||
FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
|
||||
}
|
||||
depth int
|
||||
}
|
||||
|
||||
func (o unmarshalOptions) Options() proto.UnmarshalOptions {
|
||||
@ -34,14 +37,17 @@ func (o unmarshalOptions) Options() proto.UnmarshalOptions {
|
||||
}
|
||||
}
|
||||
|
||||
func (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 }
|
||||
func (o unmarshalOptions) DiscardUnknown() bool {
|
||||
return o.flags&protoiface.UnmarshalDiscardUnknown != 0
|
||||
}
|
||||
|
||||
func (o unmarshalOptions) IsDefault() bool {
|
||||
return o.flags == 0 && o.resolver == preg.GlobalTypes
|
||||
return o.flags == 0 && o.resolver == protoregistry.GlobalTypes
|
||||
}
|
||||
|
||||
var lazyUnmarshalOptions = unmarshalOptions{
|
||||
resolver: preg.GlobalTypes,
|
||||
resolver: protoregistry.GlobalTypes,
|
||||
depth: protowire.DefaultRecursionLimit,
|
||||
}
|
||||
|
||||
type unmarshalOutput struct {
|
||||
@ -50,7 +56,7 @@ type unmarshalOutput struct {
|
||||
}
|
||||
|
||||
// unmarshal is protoreflect.Methods.Unmarshal.
|
||||
func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
|
||||
func (mi *MessageInfo) unmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
var p pointer
|
||||
if ms, ok := in.Message.(*messageState); ok {
|
||||
p = ms.pointer()
|
||||
@ -60,12 +66,13 @@ func (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutp
|
||||
out, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{
|
||||
flags: in.Flags,
|
||||
resolver: in.Resolver,
|
||||
depth: in.Depth,
|
||||
})
|
||||
var flags piface.UnmarshalOutputFlags
|
||||
var flags protoiface.UnmarshalOutputFlags
|
||||
if out.initialized {
|
||||
flags |= piface.UnmarshalInitialized
|
||||
flags |= protoiface.UnmarshalInitialized
|
||||
}
|
||||
return piface.UnmarshalOutput{
|
||||
return protoiface.UnmarshalOutput{
|
||||
Flags: flags,
|
||||
}, err
|
||||
}
|
||||
@ -80,6 +87,10 @@ var errUnknown = errors.New("unknown")
|
||||
|
||||
func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||
mi.init()
|
||||
opts.depth--
|
||||
if opts.depth < 0 {
|
||||
return out, errRecursionDepth
|
||||
}
|
||||
if flags.ProtoLegacy && mi.isMessageSet {
|
||||
return unmarshalMessageSet(mi, b, p, opts)
|
||||
}
|
||||
@ -100,13 +111,13 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.
|
||||
var n int
|
||||
tag, n = protowire.ConsumeVarint(b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
b = b[n:]
|
||||
}
|
||||
var num protowire.Number
|
||||
if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {
|
||||
return out, errors.New("invalid field number")
|
||||
return out, errDecode
|
||||
} else {
|
||||
num = protowire.Number(n)
|
||||
}
|
||||
@ -114,7 +125,7 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.
|
||||
|
||||
if wtyp == protowire.EndGroupType {
|
||||
if num != groupTag {
|
||||
return out, errors.New("mismatching end group marker")
|
||||
return out, errDecode
|
||||
}
|
||||
groupTag = 0
|
||||
break
|
||||
@ -170,10 +181,10 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.
|
||||
}
|
||||
n = protowire.ConsumeFieldValue(num, wtyp, b)
|
||||
if n < 0 {
|
||||
return out, protowire.ParseError(n)
|
||||
return out, errDecode
|
||||
}
|
||||
if !opts.DiscardUnknown() && mi.unknownOffset.IsValid() {
|
||||
u := p.Apply(mi.unknownOffset).Bytes()
|
||||
u := mi.mutableUnknownBytes(p)
|
||||
*u = protowire.AppendTag(*u, num, wtyp)
|
||||
*u = append(*u, b[:n]...)
|
||||
}
|
||||
@ -181,7 +192,7 @@ func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.
|
||||
b = b[n:]
|
||||
}
|
||||
if groupTag != 0 {
|
||||
return out, errors.New("missing end group marker")
|
||||
return out, errDecode
|
||||
}
|
||||
if mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) {
|
||||
initialized = false
|
||||
@ -200,7 +211,7 @@ func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp p
|
||||
var err error
|
||||
xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
|
||||
if err != nil {
|
||||
if err == preg.NotFound {
|
||||
if err == protoregistry.NotFound {
|
||||
return out, errUnknown
|
||||
}
|
||||
return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
|
||||
@ -221,7 +232,7 @@ func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp p
|
||||
return out, nil
|
||||
}
|
||||
case ValidationInvalid:
|
||||
return out, errors.New("invalid wire format")
|
||||
return out, errDecode
|
||||
case ValidationUnknown:
|
||||
}
|
||||
}
|
||||
|
10
actions/retest/vendor/google.golang.org/protobuf/internal/impl/encode.go
generated
vendored
10
actions/retest/vendor/google.golang.org/protobuf/internal/impl/encode.go
generated
vendored
@ -79,8 +79,9 @@ func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int
|
||||
size += f.funcs.size(fptr, f, opts)
|
||||
}
|
||||
if mi.unknownOffset.IsValid() {
|
||||
u := *p.Apply(mi.unknownOffset).Bytes()
|
||||
size += len(u)
|
||||
if u := mi.getUnknownBytes(p); u != nil {
|
||||
size += len(*u)
|
||||
}
|
||||
}
|
||||
if mi.sizecacheOffset.IsValid() {
|
||||
if size > math.MaxInt32 {
|
||||
@ -141,8 +142,9 @@ func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOpt
|
||||
}
|
||||
}
|
||||
if mi.unknownOffset.IsValid() && !mi.isMessageSet {
|
||||
u := *p.Apply(mi.unknownOffset).Bytes()
|
||||
b = append(b, u...)
|
||||
if u := mi.getUnknownBytes(p); u != nil {
|
||||
b = append(b, (*u)...)
|
||||
}
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
10
actions/retest/vendor/google.golang.org/protobuf/internal/impl/enum.go
generated
vendored
10
actions/retest/vendor/google.golang.org/protobuf/internal/impl/enum.go
generated
vendored
@ -7,15 +7,15 @@ package impl
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type EnumInfo struct {
|
||||
GoReflectType reflect.Type // int32 kind
|
||||
Desc pref.EnumDescriptor
|
||||
Desc protoreflect.EnumDescriptor
|
||||
}
|
||||
|
||||
func (t *EnumInfo) New(n pref.EnumNumber) pref.Enum {
|
||||
return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum)
|
||||
func (t *EnumInfo) New(n protoreflect.EnumNumber) protoreflect.Enum {
|
||||
return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(protoreflect.Enum)
|
||||
}
|
||||
func (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc }
|
||||
func (t *EnumInfo) Descriptor() protoreflect.EnumDescriptor { return t.Desc }
|
||||
|
26
actions/retest/vendor/google.golang.org/protobuf/internal/impl/extension.go
generated
vendored
26
actions/retest/vendor/google.golang.org/protobuf/internal/impl/extension.go
generated
vendored
@ -9,8 +9,8 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// ExtensionInfo implements ExtensionType.
|
||||
@ -45,7 +45,7 @@ type ExtensionInfo struct {
|
||||
// since the message may no longer implement the MessageV1 interface.
|
||||
//
|
||||
// Deprecated: Use the ExtendedType method instead.
|
||||
ExtendedType piface.MessageV1
|
||||
ExtendedType protoiface.MessageV1
|
||||
|
||||
// ExtensionType is the zero value of the extension type.
|
||||
//
|
||||
@ -83,31 +83,31 @@ const (
|
||||
extensionInfoFullInit = 2
|
||||
)
|
||||
|
||||
func InitExtensionInfo(xi *ExtensionInfo, xd pref.ExtensionDescriptor, goType reflect.Type) {
|
||||
func InitExtensionInfo(xi *ExtensionInfo, xd protoreflect.ExtensionDescriptor, goType reflect.Type) {
|
||||
xi.goType = goType
|
||||
xi.desc = extensionTypeDescriptor{xd, xi}
|
||||
xi.init = extensionInfoDescInit
|
||||
}
|
||||
|
||||
func (xi *ExtensionInfo) New() pref.Value {
|
||||
func (xi *ExtensionInfo) New() protoreflect.Value {
|
||||
return xi.lazyInit().New()
|
||||
}
|
||||
func (xi *ExtensionInfo) Zero() pref.Value {
|
||||
func (xi *ExtensionInfo) Zero() protoreflect.Value {
|
||||
return xi.lazyInit().Zero()
|
||||
}
|
||||
func (xi *ExtensionInfo) ValueOf(v interface{}) pref.Value {
|
||||
func (xi *ExtensionInfo) ValueOf(v interface{}) protoreflect.Value {
|
||||
return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
|
||||
}
|
||||
func (xi *ExtensionInfo) InterfaceOf(v pref.Value) interface{} {
|
||||
func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) interface{} {
|
||||
return xi.lazyInit().GoValueOf(v).Interface()
|
||||
}
|
||||
func (xi *ExtensionInfo) IsValidValue(v pref.Value) bool {
|
||||
func (xi *ExtensionInfo) IsValidValue(v protoreflect.Value) bool {
|
||||
return xi.lazyInit().IsValidPB(v)
|
||||
}
|
||||
func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
|
||||
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
|
||||
}
|
||||
func (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor {
|
||||
func (xi *ExtensionInfo) TypeDescriptor() protoreflect.ExtensionTypeDescriptor {
|
||||
if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
|
||||
xi.lazyInitSlow()
|
||||
}
|
||||
@ -144,13 +144,13 @@ func (xi *ExtensionInfo) lazyInitSlow() {
|
||||
}
|
||||
|
||||
type extensionTypeDescriptor struct {
|
||||
pref.ExtensionDescriptor
|
||||
protoreflect.ExtensionDescriptor
|
||||
xi *ExtensionInfo
|
||||
}
|
||||
|
||||
func (xtd *extensionTypeDescriptor) Type() pref.ExtensionType {
|
||||
func (xtd *extensionTypeDescriptor) Type() protoreflect.ExtensionType {
|
||||
return xtd.xi
|
||||
}
|
||||
func (xtd *extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor {
|
||||
func (xtd *extensionTypeDescriptor) Descriptor() protoreflect.ExtensionDescriptor {
|
||||
return xtd.ExtensionDescriptor
|
||||
}
|
||||
|
57
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
generated
vendored
57
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
generated
vendored
@ -13,13 +13,12 @@ import (
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// legacyEnumName returns the name of enums used in legacy code.
|
||||
// It is neither the protobuf full name nor the qualified Go name,
|
||||
// but rather an odd hybrid of both.
|
||||
func legacyEnumName(ed pref.EnumDescriptor) string {
|
||||
func legacyEnumName(ed protoreflect.EnumDescriptor) string {
|
||||
var protoPkg string
|
||||
enumName := string(ed.FullName())
|
||||
if fd := ed.ParentFile(); fd != nil {
|
||||
@ -34,68 +33,68 @@ func legacyEnumName(ed pref.EnumDescriptor) string {
|
||||
|
||||
// legacyWrapEnum wraps v as a protoreflect.Enum,
|
||||
// where v must be a int32 kind and not implement the v2 API already.
|
||||
func legacyWrapEnum(v reflect.Value) pref.Enum {
|
||||
func legacyWrapEnum(v reflect.Value) protoreflect.Enum {
|
||||
et := legacyLoadEnumType(v.Type())
|
||||
return et.New(pref.EnumNumber(v.Int()))
|
||||
return et.New(protoreflect.EnumNumber(v.Int()))
|
||||
}
|
||||
|
||||
var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
|
||||
|
||||
// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
|
||||
// where t must be an int32 kind and not implement the v2 API already.
|
||||
func legacyLoadEnumType(t reflect.Type) pref.EnumType {
|
||||
func legacyLoadEnumType(t reflect.Type) protoreflect.EnumType {
|
||||
// Fast-path: check if a EnumType is cached for this concrete type.
|
||||
if et, ok := legacyEnumTypeCache.Load(t); ok {
|
||||
return et.(pref.EnumType)
|
||||
return et.(protoreflect.EnumType)
|
||||
}
|
||||
|
||||
// Slow-path: derive enum descriptor and initialize EnumType.
|
||||
var et pref.EnumType
|
||||
var et protoreflect.EnumType
|
||||
ed := LegacyLoadEnumDesc(t)
|
||||
et = &legacyEnumType{
|
||||
desc: ed,
|
||||
goType: t,
|
||||
}
|
||||
if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
|
||||
return et.(pref.EnumType)
|
||||
return et.(protoreflect.EnumType)
|
||||
}
|
||||
return et
|
||||
}
|
||||
|
||||
type legacyEnumType struct {
|
||||
desc pref.EnumDescriptor
|
||||
desc protoreflect.EnumDescriptor
|
||||
goType reflect.Type
|
||||
m sync.Map // map[protoreflect.EnumNumber]proto.Enum
|
||||
}
|
||||
|
||||
func (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum {
|
||||
func (t *legacyEnumType) New(n protoreflect.EnumNumber) protoreflect.Enum {
|
||||
if e, ok := t.m.Load(n); ok {
|
||||
return e.(pref.Enum)
|
||||
return e.(protoreflect.Enum)
|
||||
}
|
||||
e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
|
||||
t.m.Store(n, e)
|
||||
return e
|
||||
}
|
||||
func (t *legacyEnumType) Descriptor() pref.EnumDescriptor {
|
||||
func (t *legacyEnumType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return t.desc
|
||||
}
|
||||
|
||||
type legacyEnumWrapper struct {
|
||||
num pref.EnumNumber
|
||||
pbTyp pref.EnumType
|
||||
num protoreflect.EnumNumber
|
||||
pbTyp protoreflect.EnumType
|
||||
goTyp reflect.Type
|
||||
}
|
||||
|
||||
func (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor {
|
||||
func (e *legacyEnumWrapper) Descriptor() protoreflect.EnumDescriptor {
|
||||
return e.pbTyp.Descriptor()
|
||||
}
|
||||
func (e *legacyEnumWrapper) Type() pref.EnumType {
|
||||
func (e *legacyEnumWrapper) Type() protoreflect.EnumType {
|
||||
return e.pbTyp
|
||||
}
|
||||
func (e *legacyEnumWrapper) Number() pref.EnumNumber {
|
||||
func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber {
|
||||
return e.num
|
||||
}
|
||||
func (e *legacyEnumWrapper) ProtoReflect() pref.Enum {
|
||||
func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum {
|
||||
return e
|
||||
}
|
||||
func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
||||
@ -105,8 +104,8 @@ func (e *legacyEnumWrapper) protoUnwrap() interface{} {
|
||||
}
|
||||
|
||||
var (
|
||||
_ pref.Enum = (*legacyEnumWrapper)(nil)
|
||||
_ unwrapper = (*legacyEnumWrapper)(nil)
|
||||
_ protoreflect.Enum = (*legacyEnumWrapper)(nil)
|
||||
_ unwrapper = (*legacyEnumWrapper)(nil)
|
||||
)
|
||||
|
||||
var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
|
||||
@ -115,15 +114,15 @@ var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
|
||||
// which must be an int32 kind and not implement the v2 API already.
|
||||
//
|
||||
// This is exported for testing purposes.
|
||||
func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||
func LegacyLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
|
||||
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
||||
if ed, ok := legacyEnumDescCache.Load(t); ok {
|
||||
return ed.(pref.EnumDescriptor)
|
||||
return ed.(protoreflect.EnumDescriptor)
|
||||
}
|
||||
|
||||
// Slow-path: initialize EnumDescriptor from the raw descriptor.
|
||||
ev := reflect.Zero(t).Interface()
|
||||
if _, ok := ev.(pref.Enum); ok {
|
||||
if _, ok := ev.(protoreflect.Enum); ok {
|
||||
panic(fmt.Sprintf("%v already implements proto.Enum", t))
|
||||
}
|
||||
edV1, ok := ev.(enumV1)
|
||||
@ -132,7 +131,7 @@ func LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||
}
|
||||
b, idxs := edV1.EnumDescriptor()
|
||||
|
||||
var ed pref.EnumDescriptor
|
||||
var ed protoreflect.EnumDescriptor
|
||||
if len(idxs) == 1 {
|
||||
ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
|
||||
} else {
|
||||
@ -158,10 +157,10 @@ var aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescript
|
||||
// We are unable to use the global enum registry since it is
|
||||
// unfortunately keyed by the protobuf full name, which we also do not know.
|
||||
// Thus, this produces some bogus enum descriptor based on the Go type name.
|
||||
func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||
func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
|
||||
// Fast-path: check if an EnumDescriptor is cached for this concrete type.
|
||||
if ed, ok := aberrantEnumDescCache.Load(t); ok {
|
||||
return ed.(pref.EnumDescriptor)
|
||||
return ed.(protoreflect.EnumDescriptor)
|
||||
}
|
||||
|
||||
// Slow-path: construct a bogus, but unique EnumDescriptor.
|
||||
@ -182,7 +181,7 @@ func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||
// An exhaustive query is clearly impractical, but can be best-effort.
|
||||
|
||||
if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
|
||||
return ed.(pref.EnumDescriptor)
|
||||
return ed.(protoreflect.EnumDescriptor)
|
||||
}
|
||||
return ed
|
||||
}
|
||||
@ -192,7 +191,7 @@ func aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {
|
||||
// It should be sufficiently unique within a program.
|
||||
//
|
||||
// This is exported for testing purposes.
|
||||
func AberrantDeriveFullName(t reflect.Type) pref.FullName {
|
||||
func AberrantDeriveFullName(t reflect.Type) protoreflect.FullName {
|
||||
sanitize := func(r rune) rune {
|
||||
switch {
|
||||
case r == '/':
|
||||
@ -215,5 +214,5 @@ func AberrantDeriveFullName(t reflect.Type) pref.FullName {
|
||||
ss[i] = "x" + s
|
||||
}
|
||||
}
|
||||
return pref.FullName(strings.Join(ss, "."))
|
||||
return protoreflect.FullName(strings.Join(ss, "."))
|
||||
}
|
||||
|
20
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
generated
vendored
20
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
generated
vendored
@ -12,33 +12,33 @@ import (
|
||||
"reflect"
|
||||
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// These functions exist to support exported APIs in generated protobufs.
|
||||
// While these are deprecated, they cannot be removed for compatibility reasons.
|
||||
|
||||
// LegacyEnumName returns the name of enums used in legacy code.
|
||||
func (Export) LegacyEnumName(ed pref.EnumDescriptor) string {
|
||||
func (Export) LegacyEnumName(ed protoreflect.EnumDescriptor) string {
|
||||
return legacyEnumName(ed)
|
||||
}
|
||||
|
||||
// LegacyMessageTypeOf returns the protoreflect.MessageType for m,
|
||||
// with name used as the message name if necessary.
|
||||
func (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.MessageType {
|
||||
func (Export) LegacyMessageTypeOf(m protoiface.MessageV1, name protoreflect.FullName) protoreflect.MessageType {
|
||||
if mv := (Export{}).protoMessageV2Of(m); mv != nil {
|
||||
return mv.ProtoReflect().Type()
|
||||
}
|
||||
return legacyLoadMessageInfo(reflect.TypeOf(m), name)
|
||||
return legacyLoadMessageType(reflect.TypeOf(m), name)
|
||||
}
|
||||
|
||||
// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.
|
||||
// The input can either be a string representing the enum value by name,
|
||||
// or a number representing the enum number itself.
|
||||
func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumber, error) {
|
||||
func (Export) UnmarshalJSONEnum(ed protoreflect.EnumDescriptor, b []byte) (protoreflect.EnumNumber, error) {
|
||||
if b[0] == '"' {
|
||||
var name pref.Name
|
||||
var name protoreflect.Name
|
||||
if err := json.Unmarshal(b, &name); err != nil {
|
||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||
}
|
||||
@ -48,7 +48,7 @@ func (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumb
|
||||
}
|
||||
return ev.Number(), nil
|
||||
} else {
|
||||
var num pref.EnumNumber
|
||||
var num protoreflect.EnumNumber
|
||||
if err := json.Unmarshal(b, &num); err != nil {
|
||||
return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
|
||||
}
|
||||
@ -81,8 +81,8 @@ func (Export) CompressGZIP(in []byte) (out []byte) {
|
||||
blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
|
||||
blockSize = len(in)
|
||||
}
|
||||
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000)
|
||||
binary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff)
|
||||
binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize))
|
||||
binary.LittleEndian.PutUint16(blockHeader[3:5], ^uint16(blockSize))
|
||||
out = append(out, blockHeader[:]...)
|
||||
out = append(out, in[:blockSize]...)
|
||||
in = in[blockSize:]
|
||||
|
99
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
generated
vendored
99
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
generated
vendored
@ -12,16 +12,16 @@ import (
|
||||
ptag "google.golang.org/protobuf/internal/encoding/tag"
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
func (xi *ExtensionInfo) initToLegacy() {
|
||||
xd := xi.desc
|
||||
var parent piface.MessageV1
|
||||
var parent protoiface.MessageV1
|
||||
messageName := xd.ContainingMessage().FullName()
|
||||
if mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil {
|
||||
if mt, _ := protoregistry.GlobalTypes.FindMessageByName(messageName); mt != nil {
|
||||
// Create a new parent message and unwrap it if possible.
|
||||
mv := mt.New().Interface()
|
||||
t := reflect.TypeOf(mv)
|
||||
@ -31,7 +31,7 @@ func (xi *ExtensionInfo) initToLegacy() {
|
||||
|
||||
// Check whether the message implements the legacy v1 Message interface.
|
||||
mz := reflect.Zero(t).Interface()
|
||||
if mz, ok := mz.(piface.MessageV1); ok {
|
||||
if mz, ok := mz.(protoiface.MessageV1); ok {
|
||||
parent = mz
|
||||
}
|
||||
}
|
||||
@ -46,7 +46,7 @@ func (xi *ExtensionInfo) initToLegacy() {
|
||||
|
||||
// Reconstruct the legacy enum full name.
|
||||
var enumName string
|
||||
if xd.Kind() == pref.EnumKind {
|
||||
if xd.Kind() == protoreflect.EnumKind {
|
||||
enumName = legacyEnumName(xd.Enum())
|
||||
}
|
||||
|
||||
@ -77,16 +77,16 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||
// field number is specified. In such a case, use a placeholder.
|
||||
if xi.ExtendedType == nil || xi.ExtensionType == nil {
|
||||
xd := placeholderExtension{
|
||||
name: pref.FullName(xi.Name),
|
||||
number: pref.FieldNumber(xi.Field),
|
||||
name: protoreflect.FullName(xi.Name),
|
||||
number: protoreflect.FieldNumber(xi.Field),
|
||||
}
|
||||
xi.desc = extensionTypeDescriptor{xd, xi}
|
||||
return
|
||||
}
|
||||
|
||||
// Resolve enum or message dependencies.
|
||||
var ed pref.EnumDescriptor
|
||||
var md pref.MessageDescriptor
|
||||
var ed protoreflect.EnumDescriptor
|
||||
var md protoreflect.MessageDescriptor
|
||||
t := reflect.TypeOf(xi.ExtensionType)
|
||||
isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
|
||||
isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
|
||||
@ -94,18 +94,18 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||
t = t.Elem()
|
||||
}
|
||||
switch v := reflect.Zero(t).Interface().(type) {
|
||||
case pref.Enum:
|
||||
case protoreflect.Enum:
|
||||
ed = v.Descriptor()
|
||||
case enumV1:
|
||||
ed = LegacyLoadEnumDesc(t)
|
||||
case pref.ProtoMessage:
|
||||
case protoreflect.ProtoMessage:
|
||||
md = v.ProtoReflect().Descriptor()
|
||||
case messageV1:
|
||||
md = LegacyLoadMessageDesc(t)
|
||||
}
|
||||
|
||||
// Derive basic field information from the struct tag.
|
||||
var evs pref.EnumValueDescriptors
|
||||
var evs protoreflect.EnumValueDescriptors
|
||||
if ed != nil {
|
||||
evs = ed.Values()
|
||||
}
|
||||
@ -114,8 +114,8 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||
// Construct a v2 ExtensionType.
|
||||
xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
|
||||
xd.L0.ParentFile = filedesc.SurrogateProto2
|
||||
xd.L0.FullName = pref.FullName(xi.Name)
|
||||
xd.L1.Number = pref.FieldNumber(xi.Field)
|
||||
xd.L0.FullName = protoreflect.FullName(xi.Name)
|
||||
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
|
||||
@ -138,38 +138,39 @@ func (xi *ExtensionInfo) initFromLegacy() {
|
||||
}
|
||||
|
||||
type placeholderExtension struct {
|
||||
name pref.FullName
|
||||
number pref.FieldNumber
|
||||
name protoreflect.FullName
|
||||
number protoreflect.FieldNumber
|
||||
}
|
||||
|
||||
func (x placeholderExtension) ParentFile() pref.FileDescriptor { return nil }
|
||||
func (x placeholderExtension) Parent() pref.Descriptor { return nil }
|
||||
func (x placeholderExtension) Index() int { return 0 }
|
||||
func (x placeholderExtension) Syntax() pref.Syntax { return 0 }
|
||||
func (x placeholderExtension) Name() pref.Name { return x.name.Name() }
|
||||
func (x placeholderExtension) FullName() pref.FullName { return x.name }
|
||||
func (x placeholderExtension) IsPlaceholder() bool { return true }
|
||||
func (x placeholderExtension) Options() pref.ProtoMessage { return descopts.Field }
|
||||
func (x placeholderExtension) Number() pref.FieldNumber { return x.number }
|
||||
func (x placeholderExtension) Cardinality() pref.Cardinality { return 0 }
|
||||
func (x placeholderExtension) Kind() pref.Kind { return 0 }
|
||||
func (x placeholderExtension) HasJSONName() bool { return false }
|
||||
func (x placeholderExtension) JSONName() string { return "" }
|
||||
func (x placeholderExtension) HasPresence() bool { return false }
|
||||
func (x placeholderExtension) HasOptionalKeyword() bool { return false }
|
||||
func (x placeholderExtension) IsExtension() bool { return true }
|
||||
func (x placeholderExtension) IsWeak() bool { return false }
|
||||
func (x placeholderExtension) IsPacked() bool { return false }
|
||||
func (x placeholderExtension) IsList() bool { return false }
|
||||
func (x placeholderExtension) IsMap() bool { return false }
|
||||
func (x placeholderExtension) MapKey() pref.FieldDescriptor { return nil }
|
||||
func (x placeholderExtension) MapValue() pref.FieldDescriptor { return nil }
|
||||
func (x placeholderExtension) HasDefault() bool { return false }
|
||||
func (x placeholderExtension) Default() pref.Value { return pref.Value{} }
|
||||
func (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil }
|
||||
func (x placeholderExtension) ContainingOneof() pref.OneofDescriptor { return nil }
|
||||
func (x placeholderExtension) ContainingMessage() pref.MessageDescriptor { return nil }
|
||||
func (x placeholderExtension) Enum() pref.EnumDescriptor { return nil }
|
||||
func (x placeholderExtension) Message() pref.MessageDescriptor { return nil }
|
||||
func (x placeholderExtension) ProtoType(pref.FieldDescriptor) { return }
|
||||
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
func (x placeholderExtension) ParentFile() protoreflect.FileDescriptor { return nil }
|
||||
func (x placeholderExtension) Parent() protoreflect.Descriptor { return nil }
|
||||
func (x placeholderExtension) Index() int { return 0 }
|
||||
func (x placeholderExtension) Syntax() protoreflect.Syntax { return 0 }
|
||||
func (x placeholderExtension) Name() protoreflect.Name { return x.name.Name() }
|
||||
func (x placeholderExtension) FullName() protoreflect.FullName { return x.name }
|
||||
func (x placeholderExtension) IsPlaceholder() bool { return true }
|
||||
func (x placeholderExtension) Options() protoreflect.ProtoMessage { return descopts.Field }
|
||||
func (x placeholderExtension) Number() protoreflect.FieldNumber { return x.number }
|
||||
func (x placeholderExtension) Cardinality() protoreflect.Cardinality { return 0 }
|
||||
func (x placeholderExtension) Kind() protoreflect.Kind { return 0 }
|
||||
func (x placeholderExtension) HasJSONName() bool { return false }
|
||||
func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
|
||||
func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
|
||||
func (x placeholderExtension) HasPresence() bool { return false }
|
||||
func (x placeholderExtension) HasOptionalKeyword() bool { return false }
|
||||
func (x placeholderExtension) IsExtension() bool { return true }
|
||||
func (x placeholderExtension) IsWeak() bool { return false }
|
||||
func (x placeholderExtension) IsPacked() bool { return false }
|
||||
func (x placeholderExtension) IsList() bool { return false }
|
||||
func (x placeholderExtension) IsMap() bool { return false }
|
||||
func (x placeholderExtension) MapKey() protoreflect.FieldDescriptor { return nil }
|
||||
func (x placeholderExtension) MapValue() protoreflect.FieldDescriptor { return nil }
|
||||
func (x placeholderExtension) HasDefault() bool { return false }
|
||||
func (x placeholderExtension) Default() protoreflect.Value { return protoreflect.Value{} }
|
||||
func (x placeholderExtension) DefaultEnumValue() protoreflect.EnumValueDescriptor { return nil }
|
||||
func (x placeholderExtension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
|
||||
func (x placeholderExtension) ContainingMessage() protoreflect.MessageDescriptor { return nil }
|
||||
func (x placeholderExtension) Enum() protoreflect.EnumDescriptor { return nil }
|
||||
func (x placeholderExtension) Message() protoreflect.MessageDescriptor { return nil }
|
||||
func (x placeholderExtension) ProtoType(protoreflect.FieldDescriptor) { return }
|
||||
func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
|
||||
|
235
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
235
actions/retest/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
@ -16,28 +16,36 @@ import (
|
||||
"google.golang.org/protobuf/internal/filedesc"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// legacyWrapMessage wraps v as a protoreflect.Message,
|
||||
// where v must be a *struct kind and not implement the v2 API already.
|
||||
func legacyWrapMessage(v reflect.Value) pref.Message {
|
||||
typ := v.Type()
|
||||
if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct {
|
||||
func legacyWrapMessage(v reflect.Value) protoreflect.Message {
|
||||
t := v.Type()
|
||||
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
||||
return aberrantMessage{v: v}
|
||||
}
|
||||
mt := legacyLoadMessageInfo(typ, "")
|
||||
mt := legacyLoadMessageInfo(t, "")
|
||||
return mt.MessageOf(v.Interface())
|
||||
}
|
||||
|
||||
// legacyLoadMessageType dynamically loads a protoreflect.Type for t,
|
||||
// where t must be not implement the v2 API already.
|
||||
// The provided name is used if it cannot be determined from the message.
|
||||
func legacyLoadMessageType(t reflect.Type, name protoreflect.FullName) protoreflect.MessageType {
|
||||
if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
|
||||
return aberrantMessageType{t}
|
||||
}
|
||||
return legacyLoadMessageInfo(t, name)
|
||||
}
|
||||
|
||||
var legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo
|
||||
|
||||
// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
|
||||
// where t must be a *struct kind and not implement the v2 API already.
|
||||
// The provided name is used if it cannot be determined from the message.
|
||||
func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
||||
func legacyLoadMessageInfo(t reflect.Type, name protoreflect.FullName) *MessageInfo {
|
||||
// Fast-path: check if a MessageInfo is cached for this concrete type.
|
||||
if mt, ok := legacyMessageTypeCache.Load(t); ok {
|
||||
return mt.(*MessageInfo)
|
||||
@ -49,20 +57,21 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
||||
GoReflectType: t,
|
||||
}
|
||||
|
||||
var hasMarshal, hasUnmarshal bool
|
||||
v := reflect.Zero(t).Interface()
|
||||
if _, ok := v.(legacyMarshaler); ok {
|
||||
if _, hasMarshal = v.(legacyMarshaler); hasMarshal {
|
||||
mi.methods.Marshal = legacyMarshal
|
||||
|
||||
// We have no way to tell whether the type's Marshal method
|
||||
// supports deterministic serialization or not, but this
|
||||
// preserves the v1 implementation's behavior of always
|
||||
// calling Marshal methods when present.
|
||||
mi.methods.Flags |= piface.SupportMarshalDeterministic
|
||||
mi.methods.Flags |= protoiface.SupportMarshalDeterministic
|
||||
}
|
||||
if _, ok := v.(legacyUnmarshaler); ok {
|
||||
if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
|
||||
mi.methods.Unmarshal = legacyUnmarshal
|
||||
}
|
||||
if _, ok := v.(legacyMerger); ok {
|
||||
if _, hasMerge := v.(legacyMerger); hasMerge || (hasMarshal && hasUnmarshal) {
|
||||
mi.methods.Merge = legacyMerge
|
||||
}
|
||||
|
||||
@ -75,21 +84,21 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
||||
var legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDescriptor
|
||||
|
||||
// LegacyLoadMessageDesc returns an MessageDescriptor derived from the Go type,
|
||||
// which must be a *struct kind and not implement the v2 API already.
|
||||
// which should be a *struct kind and must not implement the v2 API already.
|
||||
//
|
||||
// This is exported for testing purposes.
|
||||
func LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {
|
||||
func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {
|
||||
return legacyLoadMessageDesc(t, "")
|
||||
}
|
||||
func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
||||
func legacyLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||
// Fast-path: check if a MessageDescriptor is cached for this concrete type.
|
||||
if mi, ok := legacyMessageDescCache.Load(t); ok {
|
||||
return mi.(pref.MessageDescriptor)
|
||||
return mi.(protoreflect.MessageDescriptor)
|
||||
}
|
||||
|
||||
// Slow-path: initialize MessageDescriptor from the raw descriptor.
|
||||
mv := reflect.Zero(t).Interface()
|
||||
if _, ok := mv.(pref.ProtoMessage); ok {
|
||||
if _, ok := mv.(protoreflect.ProtoMessage); ok {
|
||||
panic(fmt.Sprintf("%v already implements proto.Message", t))
|
||||
}
|
||||
mdV1, ok := mv.(messageV1)
|
||||
@ -114,17 +123,19 @@ func legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescr
|
||||
// If the Go type has no fields, then this might be a proto3 empty message
|
||||
// from before the size cache was added. If there are any fields, check to
|
||||
// see that at least one of them looks like something we generated.
|
||||
if nfield := t.Elem().NumField(); nfield > 0 {
|
||||
hasProtoField := false
|
||||
for i := 0; i < nfield; i++ {
|
||||
f := t.Elem().Field(i)
|
||||
if f.Tag.Get("protobuf") != "" || f.Tag.Get("protobuf_oneof") != "" || strings.HasPrefix(f.Name, "XXX_") {
|
||||
hasProtoField = true
|
||||
break
|
||||
if t.Elem().Kind() == reflect.Struct {
|
||||
if nfield := t.Elem().NumField(); nfield > 0 {
|
||||
hasProtoField := false
|
||||
for i := 0; i < nfield; i++ {
|
||||
f := t.Elem().Field(i)
|
||||
if f.Tag.Get("protobuf") != "" || f.Tag.Get("protobuf_oneof") != "" || strings.HasPrefix(f.Name, "XXX_") {
|
||||
hasProtoField = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasProtoField {
|
||||
return aberrantLoadMessageDesc(t, name)
|
||||
}
|
||||
}
|
||||
if !hasProtoField {
|
||||
return aberrantLoadMessageDesc(t, name)
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +162,7 @@ var (
|
||||
//
|
||||
// This is a best-effort derivation of the message descriptor using the protobuf
|
||||
// tags on the struct fields.
|
||||
func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
||||
func aberrantLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||
aberrantMessageDescLock.Lock()
|
||||
defer aberrantMessageDescLock.Unlock()
|
||||
if aberrantMessageDescCache == nil {
|
||||
@ -159,7 +170,7 @@ func aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDes
|
||||
}
|
||||
return aberrantLoadMessageDescReentrant(t, name)
|
||||
}
|
||||
func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor {
|
||||
func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
|
||||
// Fast-path: check if an MessageDescriptor is cached for this concrete type.
|
||||
if md, ok := aberrantMessageDescCache[t]; ok {
|
||||
return md
|
||||
@ -212,9 +223,9 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||
vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
|
||||
for i := 0; i < vs.Len(); i++ {
|
||||
v := vs.Index(i)
|
||||
md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{
|
||||
pref.FieldNumber(v.FieldByName("Start").Int()),
|
||||
pref.FieldNumber(v.FieldByName("End").Int() + 1),
|
||||
md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{
|
||||
protoreflect.FieldNumber(v.FieldByName("Start").Int()),
|
||||
protoreflect.FieldNumber(v.FieldByName("End").Int() + 1),
|
||||
})
|
||||
md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
|
||||
}
|
||||
@ -232,7 +243,7 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||
n := len(md.L2.Oneofs.List)
|
||||
md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
|
||||
od := &md.L2.Oneofs.List[n]
|
||||
od.L0.FullName = md.FullName().Append(pref.Name(tag))
|
||||
od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))
|
||||
od.L0.ParentFile = md.L0.ParentFile
|
||||
od.L0.Parent = md
|
||||
od.L0.Index = n
|
||||
@ -254,14 +265,14 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.M
|
||||
return md
|
||||
}
|
||||
|
||||
func aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName {
|
||||
func aberrantDeriveMessageName(t reflect.Type, name protoreflect.FullName) protoreflect.FullName {
|
||||
if name.IsValid() {
|
||||
return name
|
||||
}
|
||||
func() {
|
||||
defer func() { recover() }() // swallow possible nil panics
|
||||
if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
|
||||
name = pref.FullName(m.XXX_MessageName())
|
||||
name = protoreflect.FullName(m.XXX_MessageName())
|
||||
}
|
||||
}()
|
||||
if name.IsValid() {
|
||||
@ -292,7 +303,7 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
||||
fd.L0.Index = n
|
||||
|
||||
if fd.L1.IsWeak || fd.L1.HasPacked {
|
||||
fd.L1.Options = func() pref.ProtoMessage {
|
||||
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))
|
||||
@ -305,17 +316,17 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
||||
}
|
||||
|
||||
// Populate Enum and Message.
|
||||
if fd.Enum() == nil && fd.Kind() == pref.EnumKind {
|
||||
if fd.Enum() == nil && fd.Kind() == protoreflect.EnumKind {
|
||||
switch v := reflect.Zero(t).Interface().(type) {
|
||||
case pref.Enum:
|
||||
case protoreflect.Enum:
|
||||
fd.L1.Enum = v.Descriptor()
|
||||
default:
|
||||
fd.L1.Enum = LegacyLoadEnumDesc(t)
|
||||
}
|
||||
}
|
||||
if fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) {
|
||||
if fd.Message() == nil && (fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind) {
|
||||
switch v := reflect.Zero(t).Interface().(type) {
|
||||
case pref.ProtoMessage:
|
||||
case protoreflect.ProtoMessage:
|
||||
fd.L1.Message = v.ProtoReflect().Descriptor()
|
||||
case messageV1:
|
||||
fd.L1.Message = LegacyLoadMessageDesc(t)
|
||||
@ -324,13 +335,13 @@ func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey,
|
||||
n := len(md.L1.Messages.List)
|
||||
md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
|
||||
md2 := &md.L1.Messages.List[n]
|
||||
md2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name()))))
|
||||
md2.L0.FullName = md.FullName().Append(protoreflect.Name(strs.MapEntryName(string(fd.Name()))))
|
||||
md2.L0.ParentFile = md.L0.ParentFile
|
||||
md2.L0.Parent = md
|
||||
md2.L0.Index = n
|
||||
|
||||
md2.L1.IsMapEntry = true
|
||||
md2.L2.Options = func() pref.ProtoMessage {
|
||||
md2.L2.Options = func() protoreflect.ProtoMessage {
|
||||
opts := descopts.Message.ProtoReflect().New()
|
||||
opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
|
||||
return opts.Interface()
|
||||
@ -351,8 +362,8 @@ type placeholderEnumValues struct {
|
||||
protoreflect.EnumValueDescriptors
|
||||
}
|
||||
|
||||
func (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor {
|
||||
return filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
|
||||
func (placeholderEnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
|
||||
return filedesc.PlaceholderEnumValue(protoreflect.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
|
||||
}
|
||||
|
||||
// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
|
||||
@ -370,7 +381,7 @@ type legacyMerger interface {
|
||||
Merge(protoiface.MessageV1)
|
||||
}
|
||||
|
||||
var legacyProtoMethods = &piface.Methods{
|
||||
var aberrantProtoMethods = &protoiface.Methods{
|
||||
Marshal: legacyMarshal,
|
||||
Unmarshal: legacyUnmarshal,
|
||||
Merge: legacyMerge,
|
||||
@ -379,41 +390,70 @@ var legacyProtoMethods = &piface.Methods{
|
||||
// supports deterministic serialization or not, but this
|
||||
// preserves the v1 implementation's behavior of always
|
||||
// calling Marshal methods when present.
|
||||
Flags: piface.SupportMarshalDeterministic,
|
||||
Flags: protoiface.SupportMarshalDeterministic,
|
||||
}
|
||||
|
||||
func legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) {
|
||||
func legacyMarshal(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
v := in.Message.(unwrapper).protoUnwrap()
|
||||
marshaler, ok := v.(legacyMarshaler)
|
||||
if !ok {
|
||||
return piface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
||||
return protoiface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
||||
}
|
||||
out, err := marshaler.Marshal()
|
||||
if in.Buf != nil {
|
||||
out = append(in.Buf, out...)
|
||||
}
|
||||
return piface.MarshalOutput{
|
||||
return protoiface.MarshalOutput{
|
||||
Buf: out,
|
||||
}, err
|
||||
}
|
||||
|
||||
func legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {
|
||||
func legacyUnmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
v := in.Message.(unwrapper).protoUnwrap()
|
||||
unmarshaler, ok := v.(legacyUnmarshaler)
|
||||
if !ok {
|
||||
return piface.UnmarshalOutput{}, errors.New("%T does not implement Marshal", v)
|
||||
return protoiface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
|
||||
}
|
||||
return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
||||
return protoiface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
||||
}
|
||||
|
||||
func legacyMerge(in piface.MergeInput) piface.MergeOutput {
|
||||
func legacyMerge(in protoiface.MergeInput) protoiface.MergeOutput {
|
||||
// Check whether this supports the legacy merger.
|
||||
dstv := in.Destination.(unwrapper).protoUnwrap()
|
||||
merger, ok := dstv.(legacyMerger)
|
||||
if !ok {
|
||||
return piface.MergeOutput{}
|
||||
if ok {
|
||||
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
||||
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||
}
|
||||
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
||||
|
||||
// If legacy merger is unavailable, implement merge in terms of
|
||||
// a marshal and unmarshal operation.
|
||||
srcv := in.Source.(unwrapper).protoUnwrap()
|
||||
marshaler, ok := srcv.(legacyMarshaler)
|
||||
if !ok {
|
||||
return protoiface.MergeOutput{}
|
||||
}
|
||||
dstv = in.Destination.(unwrapper).protoUnwrap()
|
||||
unmarshaler, ok := dstv.(legacyUnmarshaler)
|
||||
if !ok {
|
||||
return protoiface.MergeOutput{}
|
||||
}
|
||||
if !in.Source.IsValid() {
|
||||
// Legacy Marshal methods may not function on nil messages.
|
||||
// Check for a typed nil source only after we confirm that
|
||||
// legacy Marshal/Unmarshal methods are present, for
|
||||
// consistency.
|
||||
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||
}
|
||||
b, err := marshaler.Marshal()
|
||||
if err != nil {
|
||||
return protoiface.MergeOutput{}
|
||||
}
|
||||
err = unmarshaler.Unmarshal(b)
|
||||
if err != nil {
|
||||
return protoiface.MergeOutput{}
|
||||
}
|
||||
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||
}
|
||||
|
||||
// aberrantMessageType implements MessageType for all types other than pointer-to-struct.
|
||||
@ -421,16 +461,19 @@ type aberrantMessageType struct {
|
||||
t reflect.Type
|
||||
}
|
||||
|
||||
func (mt aberrantMessageType) New() pref.Message {
|
||||
func (mt aberrantMessageType) New() protoreflect.Message {
|
||||
if mt.t.Kind() == reflect.Ptr {
|
||||
return aberrantMessage{reflect.New(mt.t.Elem())}
|
||||
}
|
||||
return aberrantMessage{reflect.Zero(mt.t)}
|
||||
}
|
||||
func (mt aberrantMessageType) Zero() pref.Message {
|
||||
func (mt aberrantMessageType) Zero() protoreflect.Message {
|
||||
return aberrantMessage{reflect.Zero(mt.t)}
|
||||
}
|
||||
func (mt aberrantMessageType) GoType() reflect.Type {
|
||||
return mt.t
|
||||
}
|
||||
func (mt aberrantMessageType) Descriptor() pref.MessageDescriptor {
|
||||
func (mt aberrantMessageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return LegacyLoadMessageDesc(mt.t)
|
||||
}
|
||||
|
||||
@ -443,59 +486,77 @@ type aberrantMessage struct {
|
||||
v reflect.Value
|
||||
}
|
||||
|
||||
func (m aberrantMessage) ProtoReflect() pref.Message {
|
||||
// Reset implements the v1 proto.Message.Reset method.
|
||||
func (m aberrantMessage) Reset() {
|
||||
if mr, ok := m.v.Interface().(interface{ Reset() }); ok {
|
||||
mr.Reset()
|
||||
return
|
||||
}
|
||||
if m.v.Kind() == reflect.Ptr && !m.v.IsNil() {
|
||||
m.v.Elem().Set(reflect.Zero(m.v.Type().Elem()))
|
||||
}
|
||||
}
|
||||
|
||||
func (m aberrantMessage) ProtoReflect() protoreflect.Message {
|
||||
return m
|
||||
}
|
||||
|
||||
func (m aberrantMessage) Descriptor() pref.MessageDescriptor {
|
||||
func (m aberrantMessage) Descriptor() protoreflect.MessageDescriptor {
|
||||
return LegacyLoadMessageDesc(m.v.Type())
|
||||
}
|
||||
func (m aberrantMessage) Type() pref.MessageType {
|
||||
func (m aberrantMessage) Type() protoreflect.MessageType {
|
||||
return aberrantMessageType{m.v.Type()}
|
||||
}
|
||||
func (m aberrantMessage) New() pref.Message {
|
||||
func (m aberrantMessage) New() protoreflect.Message {
|
||||
if m.v.Type().Kind() == reflect.Ptr {
|
||||
return aberrantMessage{reflect.New(m.v.Type().Elem())}
|
||||
}
|
||||
return aberrantMessage{reflect.Zero(m.v.Type())}
|
||||
}
|
||||
func (m aberrantMessage) Interface() pref.ProtoMessage {
|
||||
func (m aberrantMessage) Interface() protoreflect.ProtoMessage {
|
||||
return m
|
||||
}
|
||||
func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
||||
func (m aberrantMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
return
|
||||
}
|
||||
func (m aberrantMessage) Has(pref.FieldDescriptor) bool {
|
||||
panic("invalid field descriptor")
|
||||
func (m aberrantMessage) Has(protoreflect.FieldDescriptor) bool {
|
||||
return false
|
||||
}
|
||||
func (m aberrantMessage) Clear(pref.FieldDescriptor) {
|
||||
panic("invalid field descriptor")
|
||||
func (m aberrantMessage) Clear(protoreflect.FieldDescriptor) {
|
||||
panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) Get(pref.FieldDescriptor) pref.Value {
|
||||
panic("invalid field descriptor")
|
||||
func (m aberrantMessage) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
if fd.Default().IsValid() {
|
||||
return fd.Default()
|
||||
}
|
||||
panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) {
|
||||
panic("invalid field descriptor")
|
||||
func (m aberrantMessage) Set(protoreflect.FieldDescriptor, protoreflect.Value) {
|
||||
panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {
|
||||
panic("invalid field descriptor")
|
||||
func (m aberrantMessage) Mutable(protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {
|
||||
panic("invalid field descriptor")
|
||||
func (m aberrantMessage) NewField(protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {
|
||||
panic("invalid oneof descriptor")
|
||||
func (m aberrantMessage) WhichOneof(protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) GetUnknown() pref.RawFields {
|
||||
func (m aberrantMessage) GetUnknown() protoreflect.RawFields {
|
||||
return nil
|
||||
}
|
||||
func (m aberrantMessage) SetUnknown(pref.RawFields) {
|
||||
func (m aberrantMessage) SetUnknown(protoreflect.RawFields) {
|
||||
// SetUnknown discards its input on messages which don't support unknown field storage.
|
||||
}
|
||||
func (m aberrantMessage) IsValid() bool {
|
||||
// An invalid message is a read-only, empty message. Since we don't know anything
|
||||
// about the alleged contents of this message, we can't say with confidence that
|
||||
// it is invalid in this sense. Therefore, report it as valid.
|
||||
return true
|
||||
if m.v.Kind() == reflect.Ptr {
|
||||
return !m.v.IsNil()
|
||||
}
|
||||
return false
|
||||
}
|
||||
func (m aberrantMessage) ProtoMethods() *piface.Methods {
|
||||
return legacyProtoMethods
|
||||
func (m aberrantMessage) ProtoMethods() *protoiface.Methods {
|
||||
return aberrantProtoMethods
|
||||
}
|
||||
func (m aberrantMessage) protoUnwrap() interface{} {
|
||||
return m.v.Interface()
|
||||
|
38
actions/retest/vendor/google.golang.org/protobuf/internal/impl/merge.go
generated
vendored
38
actions/retest/vendor/google.golang.org/protobuf/internal/impl/merge.go
generated
vendored
@ -9,8 +9,8 @@ import (
|
||||
"reflect"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
type mergeOptions struct{}
|
||||
@ -20,17 +20,17 @@ func (o mergeOptions) Merge(dst, src proto.Message) {
|
||||
}
|
||||
|
||||
// merge is protoreflect.Methods.Merge.
|
||||
func (mi *MessageInfo) merge(in piface.MergeInput) piface.MergeOutput {
|
||||
func (mi *MessageInfo) merge(in protoiface.MergeInput) protoiface.MergeOutput {
|
||||
dp, ok := mi.getPointer(in.Destination)
|
||||
if !ok {
|
||||
return piface.MergeOutput{}
|
||||
return protoiface.MergeOutput{}
|
||||
}
|
||||
sp, ok := mi.getPointer(in.Source)
|
||||
if !ok {
|
||||
return piface.MergeOutput{}
|
||||
return protoiface.MergeOutput{}
|
||||
}
|
||||
mi.mergePointer(dp, sp, mergeOptions{})
|
||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
||||
return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
|
||||
}
|
||||
|
||||
func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||
@ -64,7 +64,7 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||
continue
|
||||
}
|
||||
dx := (*dext)[num]
|
||||
var dv pref.Value
|
||||
var dv protoreflect.Value
|
||||
if dx.Type() == sx.Type() {
|
||||
dv = dx.Value()
|
||||
}
|
||||
@ -77,23 +77,23 @@ func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
|
||||
}
|
||||
}
|
||||
if mi.unknownOffset.IsValid() {
|
||||
du := dst.Apply(mi.unknownOffset).Bytes()
|
||||
su := src.Apply(mi.unknownOffset).Bytes()
|
||||
if len(*su) > 0 {
|
||||
su := mi.getUnknownBytes(src)
|
||||
if su != nil && len(*su) > 0 {
|
||||
du := mi.mutableUnknownBytes(dst)
|
||||
*du = append(*du, *su...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mergeScalarValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
func mergeScalarValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||
return src
|
||||
}
|
||||
|
||||
func mergeBytesValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
return pref.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
|
||||
func mergeBytesValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||
return protoreflect.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
|
||||
}
|
||||
|
||||
func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
func mergeListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||
dstl := dst.List()
|
||||
srcl := src.List()
|
||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||
@ -102,29 +102,29 @@ func mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
return dst
|
||||
}
|
||||
|
||||
func mergeBytesListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
func mergeBytesListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||
dstl := dst.List()
|
||||
srcl := src.List()
|
||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||
sb := srcl.Get(i).Bytes()
|
||||
db := append(emptyBuf[:], sb...)
|
||||
dstl.Append(pref.ValueOfBytes(db))
|
||||
dstl.Append(protoreflect.ValueOfBytes(db))
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func mergeMessageListValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
func mergeMessageListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||
dstl := dst.List()
|
||||
srcl := src.List()
|
||||
for i, llen := 0, srcl.Len(); i < llen; i++ {
|
||||
sm := srcl.Get(i).Message()
|
||||
dm := proto.Clone(sm.Interface()).ProtoReflect()
|
||||
dstl.Append(pref.ValueOfMessage(dm))
|
||||
dstl.Append(protoreflect.ValueOfMessage(dm))
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func mergeMessageValue(dst, src pref.Value, opts mergeOptions) pref.Value {
|
||||
func mergeMessageValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
|
||||
opts.Merge(dst.Message().Interface(), src.Message().Interface())
|
||||
return dst
|
||||
}
|
||||
|
106
actions/retest/vendor/google.golang.org/protobuf/internal/impl/message.go
generated
vendored
106
actions/retest/vendor/google.golang.org/protobuf/internal/impl/message.go
generated
vendored
@ -14,7 +14,7 @@ import (
|
||||
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
// MessageInfo provides protobuf related functionality for a given Go type
|
||||
@ -28,7 +28,7 @@ type MessageInfo struct {
|
||||
GoReflectType reflect.Type // pointer to struct
|
||||
|
||||
// Desc is the underlying message descriptor type and must be populated.
|
||||
Desc pref.MessageDescriptor
|
||||
Desc protoreflect.MessageDescriptor
|
||||
|
||||
// Exporter must be provided in a purego environment in order to provide
|
||||
// access to unexported fields.
|
||||
@ -53,7 +53,7 @@ type exporter func(v interface{}, i int) interface{}
|
||||
// is generated by our implementation of protoc-gen-go (for v2 and on).
|
||||
// If it is unable to obtain a MessageInfo, it returns nil.
|
||||
func getMessageInfo(mt reflect.Type) *MessageInfo {
|
||||
m, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage)
|
||||
m, ok := reflect.Zero(mt).Interface().(protoreflect.ProtoMessage)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
@ -96,7 +96,7 @@ func (mi *MessageInfo) initOnce() {
|
||||
// getPointer returns the pointer for a message, which should be of
|
||||
// the type of the MessageInfo. If the message is of a different type,
|
||||
// it returns ok==false.
|
||||
func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {
|
||||
func (mi *MessageInfo) getPointer(m protoreflect.Message) (p pointer, ok bool) {
|
||||
switch m := m.(type) {
|
||||
case *messageState:
|
||||
return m.pointer(), m.messageInfo() == mi
|
||||
@ -109,27 +109,34 @@ func (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {
|
||||
type (
|
||||
SizeCache = int32
|
||||
WeakFields = map[int32]protoreflect.ProtoMessage
|
||||
UnknownFields = []byte
|
||||
UnknownFields = unknownFieldsA // TODO: switch to unknownFieldsB
|
||||
unknownFieldsA = []byte
|
||||
unknownFieldsB = *[]byte
|
||||
ExtensionFields = map[int32]ExtensionField
|
||||
)
|
||||
|
||||
var (
|
||||
sizecacheType = reflect.TypeOf(SizeCache(0))
|
||||
weakFieldsType = reflect.TypeOf(WeakFields(nil))
|
||||
unknownFieldsType = reflect.TypeOf(UnknownFields(nil))
|
||||
unknownFieldsAType = reflect.TypeOf(unknownFieldsA(nil))
|
||||
unknownFieldsBType = reflect.TypeOf(unknownFieldsB(nil))
|
||||
extensionFieldsType = reflect.TypeOf(ExtensionFields(nil))
|
||||
)
|
||||
|
||||
type structInfo struct {
|
||||
sizecacheOffset offset
|
||||
sizecacheType reflect.Type
|
||||
weakOffset offset
|
||||
weakType reflect.Type
|
||||
unknownOffset offset
|
||||
unknownType reflect.Type
|
||||
extensionOffset offset
|
||||
extensionType reflect.Type
|
||||
|
||||
fieldsByNumber map[pref.FieldNumber]reflect.StructField
|
||||
oneofsByName map[pref.Name]reflect.StructField
|
||||
oneofWrappersByType map[reflect.Type]pref.FieldNumber
|
||||
oneofWrappersByNumber map[pref.FieldNumber]reflect.Type
|
||||
fieldsByNumber map[protoreflect.FieldNumber]reflect.StructField
|
||||
oneofsByName map[protoreflect.Name]reflect.StructField
|
||||
oneofWrappersByType map[reflect.Type]protoreflect.FieldNumber
|
||||
oneofWrappersByNumber map[protoreflect.FieldNumber]reflect.Type
|
||||
}
|
||||
|
||||
func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
||||
@ -139,10 +146,10 @@ func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
|
||||
unknownOffset: invalidOffset,
|
||||
extensionOffset: invalidOffset,
|
||||
|
||||
fieldsByNumber: map[pref.FieldNumber]reflect.StructField{},
|
||||
oneofsByName: map[pref.Name]reflect.StructField{},
|
||||
oneofWrappersByType: map[reflect.Type]pref.FieldNumber{},
|
||||
oneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{},
|
||||
fieldsByNumber: map[protoreflect.FieldNumber]reflect.StructField{},
|
||||
oneofsByName: map[protoreflect.Name]reflect.StructField{},
|
||||
oneofWrappersByType: map[reflect.Type]protoreflect.FieldNumber{},
|
||||
oneofWrappersByNumber: map[protoreflect.FieldNumber]reflect.Type{},
|
||||
}
|
||||
|
||||
fieldLoop:
|
||||
@ -151,29 +158,33 @@ fieldLoop:
|
||||
case genid.SizeCache_goname, genid.SizeCacheA_goname:
|
||||
if f.Type == sizecacheType {
|
||||
si.sizecacheOffset = offsetOf(f, mi.Exporter)
|
||||
si.sizecacheType = f.Type
|
||||
}
|
||||
case genid.WeakFields_goname, genid.WeakFieldsA_goname:
|
||||
if f.Type == weakFieldsType {
|
||||
si.weakOffset = offsetOf(f, mi.Exporter)
|
||||
si.weakType = f.Type
|
||||
}
|
||||
case genid.UnknownFields_goname, genid.UnknownFieldsA_goname:
|
||||
if f.Type == unknownFieldsType {
|
||||
if f.Type == unknownFieldsAType || f.Type == unknownFieldsBType {
|
||||
si.unknownOffset = offsetOf(f, mi.Exporter)
|
||||
si.unknownType = f.Type
|
||||
}
|
||||
case genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname:
|
||||
if f.Type == extensionFieldsType {
|
||||
si.extensionOffset = offsetOf(f, mi.Exporter)
|
||||
si.extensionType = f.Type
|
||||
}
|
||||
default:
|
||||
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
||||
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
||||
n, _ := strconv.ParseUint(s, 10, 64)
|
||||
si.fieldsByNumber[pref.FieldNumber(n)] = f
|
||||
si.fieldsByNumber[protoreflect.FieldNumber(n)] = f
|
||||
continue fieldLoop
|
||||
}
|
||||
}
|
||||
if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
|
||||
si.oneofsByName[pref.Name(s)] = f
|
||||
si.oneofsByName[protoreflect.Name(s)] = f
|
||||
continue fieldLoop
|
||||
}
|
||||
}
|
||||
@ -196,8 +207,8 @@ fieldLoop:
|
||||
for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
|
||||
if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
|
||||
n, _ := strconv.ParseUint(s, 10, 64)
|
||||
si.oneofWrappersByType[tf] = pref.FieldNumber(n)
|
||||
si.oneofWrappersByNumber[pref.FieldNumber(n)] = tf
|
||||
si.oneofWrappersByType[tf] = protoreflect.FieldNumber(n)
|
||||
si.oneofWrappersByNumber[protoreflect.FieldNumber(n)] = tf
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -207,9 +218,62 @@ fieldLoop:
|
||||
}
|
||||
|
||||
func (mi *MessageInfo) New() protoreflect.Message {
|
||||
return mi.MessageOf(reflect.New(mi.GoReflectType.Elem()).Interface())
|
||||
m := reflect.New(mi.GoReflectType.Elem()).Interface()
|
||||
if r, ok := m.(protoreflect.ProtoMessage); ok {
|
||||
return r.ProtoReflect()
|
||||
}
|
||||
return mi.MessageOf(m)
|
||||
}
|
||||
func (mi *MessageInfo) Zero() protoreflect.Message {
|
||||
return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())
|
||||
}
|
||||
func (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor { return mi.Desc }
|
||||
func (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor {
|
||||
return mi.Desc
|
||||
}
|
||||
func (mi *MessageInfo) Enum(i int) protoreflect.EnumType {
|
||||
mi.init()
|
||||
fd := mi.Desc.Fields().Get(i)
|
||||
return Export{}.EnumTypeOf(mi.fieldTypes[fd.Number()])
|
||||
}
|
||||
func (mi *MessageInfo) Message(i int) protoreflect.MessageType {
|
||||
mi.init()
|
||||
fd := mi.Desc.Fields().Get(i)
|
||||
switch {
|
||||
case fd.IsWeak():
|
||||
mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName())
|
||||
return mt
|
||||
case fd.IsMap():
|
||||
return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
|
||||
default:
|
||||
return Export{}.MessageTypeOf(mi.fieldTypes[fd.Number()])
|
||||
}
|
||||
}
|
||||
|
||||
type mapEntryType struct {
|
||||
desc protoreflect.MessageDescriptor
|
||||
valType interface{} // zero value of enum or message type
|
||||
}
|
||||
|
||||
func (mt mapEntryType) New() protoreflect.Message {
|
||||
return nil
|
||||
}
|
||||
func (mt mapEntryType) Zero() protoreflect.Message {
|
||||
return nil
|
||||
}
|
||||
func (mt mapEntryType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return mt.desc
|
||||
}
|
||||
func (mt mapEntryType) Enum(i int) protoreflect.EnumType {
|
||||
fd := mt.desc.Fields().Get(i)
|
||||
if fd.Enum() == nil {
|
||||
return nil
|
||||
}
|
||||
return Export{}.EnumTypeOf(mt.valType)
|
||||
}
|
||||
func (mt mapEntryType) Message(i int) protoreflect.MessageType {
|
||||
fd := mt.desc.Fields().Get(i)
|
||||
if fd.Message() == nil {
|
||||
return nil
|
||||
}
|
||||
return Export{}.MessageTypeOf(mt.valType)
|
||||
}
|
||||
|
191
actions/retest/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
generated
vendored
191
actions/retest/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
generated
vendored
@ -8,13 +8,19 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"google.golang.org/protobuf/internal/detrand"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type reflectMessageInfo struct {
|
||||
fields map[pref.FieldNumber]*fieldInfo
|
||||
oneofs map[pref.Name]*oneofInfo
|
||||
fields map[protoreflect.FieldNumber]*fieldInfo
|
||||
oneofs map[protoreflect.Name]*oneofInfo
|
||||
|
||||
// fieldTypes contains the zero value of an enum or message field.
|
||||
// For lists, it contains the element type.
|
||||
// For maps, it contains the entry value type.
|
||||
fieldTypes map[protoreflect.FieldNumber]interface{}
|
||||
|
||||
// denseFields is a subset of fields where:
|
||||
// 0 < fieldDesc.Number() < len(denseFields)
|
||||
@ -24,8 +30,8 @@ type reflectMessageInfo struct {
|
||||
// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
|
||||
rangeInfos []interface{} // either *fieldInfo or *oneofInfo
|
||||
|
||||
getUnknown func(pointer) pref.RawFields
|
||||
setUnknown func(pointer, pref.RawFields)
|
||||
getUnknown func(pointer) protoreflect.RawFields
|
||||
setUnknown func(pointer, protoreflect.RawFields)
|
||||
extensionMap func(pointer) *extensionMap
|
||||
|
||||
nilMessage atomicNilMessage
|
||||
@ -36,6 +42,7 @@ func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {
|
||||
mi.makeKnownFieldsFunc(si)
|
||||
mi.makeUnknownFieldsFunc(t, si)
|
||||
mi.makeExtensionFieldsFunc(t, si)
|
||||
mi.makeFieldTypes(si)
|
||||
}
|
||||
|
||||
// makeKnownFieldsFunc generates functions for operations that can be performed
|
||||
@ -45,23 +52,29 @@ func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {
|
||||
// This code assumes that the struct is well-formed and panics if there are
|
||||
// any discrepancies.
|
||||
func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
||||
mi.fields = map[pref.FieldNumber]*fieldInfo{}
|
||||
mi.fields = map[protoreflect.FieldNumber]*fieldInfo{}
|
||||
md := mi.Desc
|
||||
fds := md.Fields()
|
||||
for i := 0; i < fds.Len(); i++ {
|
||||
fd := fds.Get(i)
|
||||
fs := si.fieldsByNumber[fd.Number()]
|
||||
isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()
|
||||
if isOneof {
|
||||
fs = si.oneofsByName[fd.ContainingOneof().Name()]
|
||||
}
|
||||
var fi fieldInfo
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
fi = fieldInfoForOneof(fd, si.oneofsByName[fd.ContainingOneof().Name()], mi.Exporter, si.oneofWrappersByNumber[fd.Number()])
|
||||
case fs.Type == nil:
|
||||
fi = fieldInfoForMissing(fd) // never occurs for officially generated message types
|
||||
case isOneof:
|
||||
fi = fieldInfoForOneof(fd, fs, mi.Exporter, si.oneofWrappersByNumber[fd.Number()])
|
||||
case fd.IsMap():
|
||||
fi = fieldInfoForMap(fd, fs, mi.Exporter)
|
||||
case fd.IsList():
|
||||
fi = fieldInfoForList(fd, fs, mi.Exporter)
|
||||
case fd.IsWeak():
|
||||
fi = fieldInfoForWeakMessage(fd, si.weakOffset)
|
||||
case fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind:
|
||||
case fd.Message() != nil:
|
||||
fi = fieldInfoForMessage(fd, fs, mi.Exporter)
|
||||
default:
|
||||
fi = fieldInfoForScalar(fd, fs, mi.Exporter)
|
||||
@ -69,7 +82,7 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
||||
mi.fields[fd.Number()] = &fi
|
||||
}
|
||||
|
||||
mi.oneofs = map[pref.Name]*oneofInfo{}
|
||||
mi.oneofs = map[protoreflect.Name]*oneofInfo{}
|
||||
for i := 0; i < md.Oneofs().Len(); i++ {
|
||||
od := md.Oneofs().Get(i)
|
||||
mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)
|
||||
@ -92,31 +105,57 @@ func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
// Introduce instability to iteration order, but keep it deterministic.
|
||||
if len(mi.rangeInfos) > 1 && detrand.Bool() {
|
||||
i := detrand.Intn(len(mi.rangeInfos) - 1)
|
||||
mi.rangeInfos[i], mi.rangeInfos[i+1] = mi.rangeInfos[i+1], mi.rangeInfos[i]
|
||||
}
|
||||
}
|
||||
|
||||
func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
|
||||
mi.getUnknown = func(pointer) pref.RawFields { return nil }
|
||||
mi.setUnknown = func(pointer, pref.RawFields) { return }
|
||||
if si.unknownOffset.IsValid() {
|
||||
mi.getUnknown = func(p pointer) pref.RawFields {
|
||||
switch {
|
||||
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:
|
||||
// Handle as []byte.
|
||||
mi.getUnknown = func(p pointer) protoreflect.RawFields {
|
||||
if p.IsNil() {
|
||||
return nil
|
||||
}
|
||||
rv := p.Apply(si.unknownOffset).AsValueOf(unknownFieldsType)
|
||||
return pref.RawFields(*rv.Interface().(*[]byte))
|
||||
return *p.Apply(mi.unknownOffset).Bytes()
|
||||
}
|
||||
mi.setUnknown = func(p pointer, b pref.RawFields) {
|
||||
mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
|
||||
if p.IsNil() {
|
||||
panic("invalid SetUnknown on nil Message")
|
||||
}
|
||||
rv := p.Apply(si.unknownOffset).AsValueOf(unknownFieldsType)
|
||||
*rv.Interface().(*[]byte) = []byte(b)
|
||||
*p.Apply(mi.unknownOffset).Bytes() = b
|
||||
}
|
||||
} else {
|
||||
mi.getUnknown = func(pointer) pref.RawFields {
|
||||
case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:
|
||||
// Handle as *[]byte.
|
||||
mi.getUnknown = func(p pointer) protoreflect.RawFields {
|
||||
if p.IsNil() {
|
||||
return nil
|
||||
}
|
||||
bp := p.Apply(mi.unknownOffset).BytesPtr()
|
||||
if *bp == nil {
|
||||
return nil
|
||||
}
|
||||
return **bp
|
||||
}
|
||||
mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
|
||||
if p.IsNil() {
|
||||
panic("invalid SetUnknown on nil Message")
|
||||
}
|
||||
bp := p.Apply(mi.unknownOffset).BytesPtr()
|
||||
if *bp == nil {
|
||||
*bp = new([]byte)
|
||||
}
|
||||
**bp = b
|
||||
}
|
||||
default:
|
||||
mi.getUnknown = func(pointer) protoreflect.RawFields {
|
||||
return nil
|
||||
}
|
||||
mi.setUnknown = func(p pointer, _ pref.RawFields) {
|
||||
mi.setUnknown = func(p pointer, _ protoreflect.RawFields) {
|
||||
if p.IsNil() {
|
||||
panic("invalid SetUnknown on nil Message")
|
||||
}
|
||||
@ -139,10 +178,62 @@ func (mi *MessageInfo) makeExtensionFieldsFunc(t reflect.Type, si structInfo) {
|
||||
}
|
||||
}
|
||||
}
|
||||
func (mi *MessageInfo) makeFieldTypes(si structInfo) {
|
||||
md := mi.Desc
|
||||
fds := md.Fields()
|
||||
for i := 0; i < fds.Len(); i++ {
|
||||
var ft reflect.Type
|
||||
fd := fds.Get(i)
|
||||
fs := si.fieldsByNumber[fd.Number()]
|
||||
isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()
|
||||
if isOneof {
|
||||
fs = si.oneofsByName[fd.ContainingOneof().Name()]
|
||||
}
|
||||
var isMessage bool
|
||||
switch {
|
||||
case fs.Type == nil:
|
||||
continue // never occurs for officially generated message types
|
||||
case isOneof:
|
||||
if fd.Enum() != nil || fd.Message() != nil {
|
||||
ft = si.oneofWrappersByNumber[fd.Number()].Field(0).Type
|
||||
}
|
||||
case fd.IsMap():
|
||||
if fd.MapValue().Enum() != nil || fd.MapValue().Message() != nil {
|
||||
ft = fs.Type.Elem()
|
||||
}
|
||||
isMessage = fd.MapValue().Message() != nil
|
||||
case fd.IsList():
|
||||
if fd.Enum() != nil || fd.Message() != nil {
|
||||
ft = fs.Type.Elem()
|
||||
}
|
||||
isMessage = fd.Message() != nil
|
||||
case fd.Enum() != nil:
|
||||
ft = fs.Type
|
||||
if fd.HasPresence() && ft.Kind() == reflect.Ptr {
|
||||
ft = ft.Elem()
|
||||
}
|
||||
case fd.Message() != nil:
|
||||
ft = fs.Type
|
||||
if fd.IsWeak() {
|
||||
ft = nil
|
||||
}
|
||||
isMessage = true
|
||||
}
|
||||
if isMessage && ft != nil && ft.Kind() != reflect.Ptr {
|
||||
ft = reflect.PtrTo(ft) // never occurs for officially generated message types
|
||||
}
|
||||
if ft != nil {
|
||||
if mi.fieldTypes == nil {
|
||||
mi.fieldTypes = make(map[protoreflect.FieldNumber]interface{})
|
||||
}
|
||||
mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type extensionMap map[int32]ExtensionField
|
||||
|
||||
func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
||||
func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if m != nil {
|
||||
for _, x := range *m {
|
||||
xd := x.Type().TypeDescriptor()
|
||||
@ -156,7 +247,7 @@ func (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
||||
}
|
||||
}
|
||||
}
|
||||
func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {
|
||||
func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) {
|
||||
if m == nil {
|
||||
return false
|
||||
}
|
||||
@ -175,10 +266,10 @@ func (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *extensionMap) Clear(xt pref.ExtensionType) {
|
||||
func (m *extensionMap) Clear(xt protoreflect.ExtensionType) {
|
||||
delete(*m, int32(xt.TypeDescriptor().Number()))
|
||||
}
|
||||
func (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {
|
||||
func (m *extensionMap) Get(xt protoreflect.ExtensionType) protoreflect.Value {
|
||||
xd := xt.TypeDescriptor()
|
||||
if m != nil {
|
||||
if x, ok := (*m)[int32(xd.Number())]; ok {
|
||||
@ -187,7 +278,7 @@ func (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {
|
||||
}
|
||||
return xt.Zero()
|
||||
}
|
||||
func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
||||
func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) {
|
||||
xd := xt.TypeDescriptor()
|
||||
isValid := true
|
||||
switch {
|
||||
@ -211,9 +302,9 @@ func (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {
|
||||
x.Set(xt, v)
|
||||
(*m)[int32(xd.Number())] = x
|
||||
}
|
||||
func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
||||
func (m *extensionMap) Mutable(xt protoreflect.ExtensionType) protoreflect.Value {
|
||||
xd := xt.TypeDescriptor()
|
||||
if xd.Kind() != pref.MessageKind && xd.Kind() != pref.GroupKind && !xd.IsList() && !xd.IsMap() {
|
||||
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 {
|
||||
@ -229,7 +320,6 @@ func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
||||
// in an allocation-free way without needing to have a shadow Go type generated
|
||||
// for every message type. This technique only works using unsafe.
|
||||
//
|
||||
//
|
||||
// Example generated code:
|
||||
//
|
||||
// type M struct {
|
||||
@ -260,12 +350,11 @@ func (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {
|
||||
// It has access to the message info as its first field, and a pointer to the
|
||||
// MessageState is identical to a pointer to the concrete message value.
|
||||
//
|
||||
//
|
||||
// Requirements:
|
||||
// • The type M must implement protoreflect.ProtoMessage.
|
||||
// • The address of m must not be nil.
|
||||
// • The address of m and the address of m.state must be equal,
|
||||
// even though they are different Go types.
|
||||
// - The type M must implement protoreflect.ProtoMessage.
|
||||
// - The address of m must not be nil.
|
||||
// - The address of m and the address of m.state must be equal,
|
||||
// even though they are different Go types.
|
||||
type MessageState struct {
|
||||
pragma.NoUnkeyedLiterals
|
||||
pragma.DoNotCompare
|
||||
@ -277,8 +366,8 @@ type MessageState struct {
|
||||
type messageState MessageState
|
||||
|
||||
var (
|
||||
_ pref.Message = (*messageState)(nil)
|
||||
_ unwrapper = (*messageState)(nil)
|
||||
_ protoreflect.Message = (*messageState)(nil)
|
||||
_ unwrapper = (*messageState)(nil)
|
||||
)
|
||||
|
||||
// messageDataType is a tuple of a pointer to the message data and
|
||||
@ -296,17 +385,16 @@ type (
|
||||
)
|
||||
|
||||
var (
|
||||
_ pref.Message = (*messageReflectWrapper)(nil)
|
||||
_ unwrapper = (*messageReflectWrapper)(nil)
|
||||
_ pref.ProtoMessage = (*messageIfaceWrapper)(nil)
|
||||
_ unwrapper = (*messageIfaceWrapper)(nil)
|
||||
_ protoreflect.Message = (*messageReflectWrapper)(nil)
|
||||
_ unwrapper = (*messageReflectWrapper)(nil)
|
||||
_ protoreflect.ProtoMessage = (*messageIfaceWrapper)(nil)
|
||||
_ unwrapper = (*messageIfaceWrapper)(nil)
|
||||
)
|
||||
|
||||
// MessageOf returns a reflective view over a message. The input must be a
|
||||
// pointer to a named Go struct. If the provided type has a ProtoReflect method,
|
||||
// it must be implemented by calling this method.
|
||||
func (mi *MessageInfo) MessageOf(m interface{}) pref.Message {
|
||||
// TODO: Switch the input to be an opaque Pointer.
|
||||
func (mi *MessageInfo) MessageOf(m interface{}) protoreflect.Message {
|
||||
if reflect.TypeOf(m) != mi.GoReflectType {
|
||||
panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
|
||||
}
|
||||
@ -320,7 +408,18 @@ func (mi *MessageInfo) MessageOf(m interface{}) pref.Message {
|
||||
func (m *messageReflectWrapper) pointer() pointer { return m.p }
|
||||
func (m *messageReflectWrapper) messageInfo() *MessageInfo { return m.mi }
|
||||
|
||||
func (m *messageIfaceWrapper) ProtoReflect() pref.Message {
|
||||
// Reset implements the v1 proto.Message.Reset method.
|
||||
func (m *messageIfaceWrapper) Reset() {
|
||||
if mr, ok := m.protoUnwrap().(interface{ Reset() }); ok {
|
||||
mr.Reset()
|
||||
return
|
||||
}
|
||||
rv := reflect.ValueOf(m.protoUnwrap())
|
||||
if rv.Kind() == reflect.Ptr && !rv.IsNil() {
|
||||
rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
|
||||
}
|
||||
}
|
||||
func (m *messageIfaceWrapper) ProtoReflect() protoreflect.Message {
|
||||
return (*messageReflectWrapper)(m)
|
||||
}
|
||||
func (m *messageIfaceWrapper) protoUnwrap() interface{} {
|
||||
@ -329,7 +428,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 pref.FieldDescriptor) (*fieldInfo, pref.ExtensionType) {
|
||||
func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionType) {
|
||||
var fi *fieldInfo
|
||||
if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
|
||||
fi = mi.denseFields[n]
|
||||
@ -354,7 +453,7 @@ func (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.Ext
|
||||
if !mi.Desc.ExtensionRanges().Has(fd.Number()) {
|
||||
panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName()))
|
||||
}
|
||||
xtd, ok := fd.(pref.ExtensionTypeDescriptor)
|
||||
xtd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
|
||||
}
|
||||
|
191
actions/retest/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
generated
vendored
191
actions/retest/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
generated
vendored
@ -11,24 +11,57 @@ import (
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/internal/flags"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
type fieldInfo struct {
|
||||
fieldDesc pref.FieldDescriptor
|
||||
fieldDesc protoreflect.FieldDescriptor
|
||||
|
||||
// These fields are used for protobuf reflection support.
|
||||
has func(pointer) bool
|
||||
clear func(pointer)
|
||||
get func(pointer) pref.Value
|
||||
set func(pointer, pref.Value)
|
||||
mutable func(pointer) pref.Value
|
||||
newMessage func() pref.Message
|
||||
newField func() pref.Value
|
||||
get func(pointer) protoreflect.Value
|
||||
set func(pointer, protoreflect.Value)
|
||||
mutable func(pointer) protoreflect.Value
|
||||
newMessage func() protoreflect.Message
|
||||
newField func() protoreflect.Value
|
||||
}
|
||||
|
||||
func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
|
||||
func fieldInfoForMissing(fd protoreflect.FieldDescriptor) fieldInfo {
|
||||
// This never occurs for generated message types.
|
||||
// It implies that a hand-crafted type has missing Go fields
|
||||
// for specific protobuf message fields.
|
||||
return fieldInfo{
|
||||
fieldDesc: fd,
|
||||
has: func(p pointer) bool {
|
||||
return false
|
||||
},
|
||||
clear: func(p pointer) {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
return fd.Default()
|
||||
},
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
mutable: func(p pointer) protoreflect.Value {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
newMessage: func() protoreflect.Message {
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
newField: func() protoreflect.Value {
|
||||
if v := fd.Default(); v.IsValid() {
|
||||
return v
|
||||
}
|
||||
panic("missing Go struct field for " + string(fd.FullName()))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func fieldInfoForOneof(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
|
||||
ft := fs.Type
|
||||
if ft.Kind() != reflect.Interface {
|
||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft))
|
||||
@ -69,7 +102,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||
}
|
||||
rv.Set(reflect.Zero(rv.Type()))
|
||||
},
|
||||
get: func(p pointer) pref.Value {
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
if p.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
@ -80,7 +113,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||
rv = rv.Elem().Elem().Field(0)
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
set: func(p pointer, v pref.Value) {
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
|
||||
rv.Set(reflect.New(ot))
|
||||
@ -88,7 +121,7 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||
rv = rv.Elem().Elem().Field(0)
|
||||
rv.Set(conv.GoValueOf(v))
|
||||
},
|
||||
mutable: func(p pointer) pref.Value {
|
||||
mutable: func(p pointer) protoreflect.Value {
|
||||
if !isMessage {
|
||||
panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName()))
|
||||
}
|
||||
@ -97,21 +130,21 @@ func fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x export
|
||||
rv.Set(reflect.New(ot))
|
||||
}
|
||||
rv = rv.Elem().Elem().Field(0)
|
||||
if rv.IsNil() {
|
||||
rv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message())))
|
||||
if rv.Kind() == reflect.Ptr && rv.IsNil() {
|
||||
rv.Set(conv.GoValueOf(protoreflect.ValueOfMessage(conv.New().Message())))
|
||||
}
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
newMessage: func() pref.Message {
|
||||
newMessage: func() protoreflect.Message {
|
||||
return conv.New().Message()
|
||||
},
|
||||
newField: func() pref.Value {
|
||||
newField: func() protoreflect.Value {
|
||||
return conv.New()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
func fieldInfoForMap(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
ft := fs.Type
|
||||
if ft.Kind() != reflect.Map {
|
||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft))
|
||||
@ -133,7 +166,7 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
rv.Set(reflect.Zero(rv.Type()))
|
||||
},
|
||||
get: func(p pointer) pref.Value {
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
if p.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
@ -143,7 +176,7 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
||||
}
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
set: func(p pointer, v pref.Value) {
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
pv := conv.GoValueOf(v)
|
||||
if pv.IsNil() {
|
||||
@ -151,20 +184,20 @@ func fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter
|
||||
}
|
||||
rv.Set(pv)
|
||||
},
|
||||
mutable: func(p pointer) pref.Value {
|
||||
mutable: func(p pointer) protoreflect.Value {
|
||||
v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if v.IsNil() {
|
||||
v.Set(reflect.MakeMap(fs.Type))
|
||||
}
|
||||
return conv.PBValueOf(v)
|
||||
},
|
||||
newField: func() pref.Value {
|
||||
newField: func() protoreflect.Value {
|
||||
return conv.New()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
func fieldInfoForList(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
ft := fs.Type
|
||||
if ft.Kind() != reflect.Slice {
|
||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft))
|
||||
@ -186,7 +219,7 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
rv.Set(reflect.Zero(rv.Type()))
|
||||
},
|
||||
get: func(p pointer) pref.Value {
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
if p.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
@ -196,7 +229,7 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
||||
}
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
set: func(p pointer, v pref.Value) {
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
pv := conv.GoValueOf(v)
|
||||
if pv.IsNil() {
|
||||
@ -204,11 +237,11 @@ func fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporte
|
||||
}
|
||||
rv.Set(pv.Elem())
|
||||
},
|
||||
mutable: func(p pointer) pref.Value {
|
||||
mutable: func(p pointer) protoreflect.Value {
|
||||
v := p.Apply(fieldOffset).AsValueOf(fs.Type)
|
||||
return conv.PBValueOf(v)
|
||||
},
|
||||
newField: func() pref.Value {
|
||||
newField: func() protoreflect.Value {
|
||||
return conv.New()
|
||||
},
|
||||
}
|
||||
@ -219,13 +252,16 @@ var (
|
||||
emptyBytes = reflect.ValueOf([]byte{})
|
||||
)
|
||||
|
||||
func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
ft := fs.Type
|
||||
nullable := fd.HasPresence()
|
||||
isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8
|
||||
if nullable {
|
||||
if ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice {
|
||||
panic(fmt.Sprintf("field %v has invalid type: got %v, want pointer", fd.FullName(), ft))
|
||||
// This never occurs for generated message types.
|
||||
// Despite the protobuf type system specifying presence,
|
||||
// the Go field type cannot represent it.
|
||||
nullable = false
|
||||
}
|
||||
if ft.Kind() == reflect.Ptr {
|
||||
ft = ft.Elem()
|
||||
@ -264,7 +300,7 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
rv.Set(reflect.Zero(rv.Type()))
|
||||
},
|
||||
get: func(p pointer) pref.Value {
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
if p.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
@ -279,7 +315,7 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
||||
}
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
set: func(p pointer, v pref.Value) {
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if nullable && rv.Kind() == reflect.Ptr {
|
||||
if rv.IsNil() {
|
||||
@ -296,23 +332,23 @@ func fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x expor
|
||||
}
|
||||
}
|
||||
},
|
||||
newField: func() pref.Value {
|
||||
newField: func() protoreflect.Value {
|
||||
return conv.New()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldInfo {
|
||||
func fieldInfoForWeakMessage(fd protoreflect.FieldDescriptor, weakOffset offset) fieldInfo {
|
||||
if !flags.ProtoLegacy {
|
||||
panic("no support for proto1 weak fields")
|
||||
}
|
||||
|
||||
var once sync.Once
|
||||
var messageType pref.MessageType
|
||||
var messageType protoreflect.MessageType
|
||||
lazyInit := func() {
|
||||
once.Do(func() {
|
||||
messageName := fd.Message().FullName()
|
||||
messageType, _ = preg.GlobalTypes.FindMessageByName(messageName)
|
||||
messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||
if messageType == nil {
|
||||
panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName()))
|
||||
}
|
||||
@ -332,18 +368,18 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
||||
clear: func(p pointer) {
|
||||
p.Apply(weakOffset).WeakFields().clear(num)
|
||||
},
|
||||
get: func(p pointer) pref.Value {
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
lazyInit()
|
||||
if p.IsNil() {
|
||||
return pref.ValueOfMessage(messageType.Zero())
|
||||
return protoreflect.ValueOfMessage(messageType.Zero())
|
||||
}
|
||||
m, ok := p.Apply(weakOffset).WeakFields().get(num)
|
||||
if !ok {
|
||||
return pref.ValueOfMessage(messageType.Zero())
|
||||
return protoreflect.ValueOfMessage(messageType.Zero())
|
||||
}
|
||||
return pref.ValueOfMessage(m.ProtoReflect())
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
},
|
||||
set: func(p pointer, v pref.Value) {
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
lazyInit()
|
||||
m := v.Message()
|
||||
if m.Descriptor() != messageType.Descriptor() {
|
||||
@ -354,7 +390,7 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
||||
}
|
||||
p.Apply(weakOffset).WeakFields().set(num, m.Interface())
|
||||
},
|
||||
mutable: func(p pointer) pref.Value {
|
||||
mutable: func(p pointer) protoreflect.Value {
|
||||
lazyInit()
|
||||
fs := p.Apply(weakOffset).WeakFields()
|
||||
m, ok := fs.get(num)
|
||||
@ -362,20 +398,20 @@ func fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldIn
|
||||
m = messageType.New().Interface()
|
||||
fs.set(num, m)
|
||||
}
|
||||
return pref.ValueOfMessage(m.ProtoReflect())
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
},
|
||||
newMessage: func() pref.Message {
|
||||
newMessage: func() protoreflect.Message {
|
||||
lazyInit()
|
||||
return messageType.New()
|
||||
},
|
||||
newField: func() pref.Value {
|
||||
newField: func() protoreflect.Value {
|
||||
lazyInit()
|
||||
return pref.ValueOfMessage(messageType.New())
|
||||
return protoreflect.ValueOfMessage(messageType.New())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
func fieldInfoForMessage(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
|
||||
ft := fs.Type
|
||||
conv := NewConverter(ft, fd)
|
||||
|
||||
@ -388,53 +424,56 @@ func fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x expo
|
||||
return false
|
||||
}
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if fs.Type.Kind() != reflect.Ptr {
|
||||
return !isZero(rv)
|
||||
}
|
||||
return !rv.IsNil()
|
||||
},
|
||||
clear: func(p pointer) {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
rv.Set(reflect.Zero(rv.Type()))
|
||||
},
|
||||
get: func(p pointer) pref.Value {
|
||||
get: func(p pointer) protoreflect.Value {
|
||||
if p.IsNil() {
|
||||
return conv.Zero()
|
||||
}
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
set: func(p pointer, v pref.Value) {
|
||||
set: func(p pointer, v protoreflect.Value) {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
rv.Set(conv.GoValueOf(v))
|
||||
if rv.IsNil() {
|
||||
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
||||
panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName()))
|
||||
}
|
||||
},
|
||||
mutable: func(p pointer) pref.Value {
|
||||
mutable: func(p pointer) protoreflect.Value {
|
||||
rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
|
||||
if rv.IsNil() {
|
||||
if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
|
||||
rv.Set(conv.GoValueOf(conv.New()))
|
||||
}
|
||||
return conv.PBValueOf(rv)
|
||||
},
|
||||
newMessage: func() pref.Message {
|
||||
newMessage: func() protoreflect.Message {
|
||||
return conv.New().Message()
|
||||
},
|
||||
newField: func() pref.Value {
|
||||
newField: func() protoreflect.Value {
|
||||
return conv.New()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type oneofInfo struct {
|
||||
oneofDesc pref.OneofDescriptor
|
||||
which func(pointer) pref.FieldNumber
|
||||
oneofDesc protoreflect.OneofDescriptor
|
||||
which func(pointer) protoreflect.FieldNumber
|
||||
}
|
||||
|
||||
func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
|
||||
func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
|
||||
oi := &oneofInfo{oneofDesc: od}
|
||||
if od.IsSynthetic() {
|
||||
fs := si.fieldsByNumber[od.Fields().Get(0).Number()]
|
||||
fieldOffset := offsetOf(fs, x)
|
||||
oi.which = func(p pointer) pref.FieldNumber {
|
||||
oi.which = func(p pointer) protoreflect.FieldNumber {
|
||||
if p.IsNil() {
|
||||
return 0
|
||||
}
|
||||
@ -447,7 +486,7 @@ func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInf
|
||||
} else {
|
||||
fs := si.oneofsByName[od.Name()]
|
||||
fieldOffset := offsetOf(fs, x)
|
||||
oi.which = func(p pointer) pref.FieldNumber {
|
||||
oi.which = func(p pointer) protoreflect.FieldNumber {
|
||||
if p.IsNil() {
|
||||
return 0
|
||||
}
|
||||
@ -464,3 +503,41 @@ func makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInf
|
||||
}
|
||||
return oi
|
||||
}
|
||||
|
||||
// isZero is identical to reflect.Value.IsZero.
|
||||
// TODO: Remove this when Go1.13 is the minimally supported Go version.
|
||||
func isZero(v reflect.Value) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Bool:
|
||||
return !v.Bool()
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return v.Int() == 0
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
return v.Uint() == 0
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return math.Float64bits(v.Float()) == 0
|
||||
case reflect.Complex64, reflect.Complex128:
|
||||
c := v.Complex()
|
||||
return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0
|
||||
case reflect.Array:
|
||||
for i := 0; i < v.Len(); i++ {
|
||||
if !isZero(v.Index(i)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
|
||||
return v.IsNil()
|
||||
case reflect.String:
|
||||
return v.Len() == 0
|
||||
case reflect.Struct:
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
if !isZero(v.Field(i)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
default:
|
||||
panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()})
|
||||
}
|
||||
}
|
||||
|
2
actions/retest/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
generated
vendored
2
actions/retest/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// 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 impl
|
||||
@ -121,6 +122,7 @@ func (p pointer) String() *string { return p.v.Interface().(*string) }
|
||||
func (p pointer) StringPtr() **string { return p.v.Interface().(**string) }
|
||||
func (p pointer) StringSlice() *[]string { return p.v.Interface().(*[]string) }
|
||||
func (p pointer) Bytes() *[]byte { return p.v.Interface().(*[]byte) }
|
||||
func (p pointer) BytesPtr() **[]byte { return p.v.Interface().(**[]byte) }
|
||||
func (p pointer) BytesSlice() *[][]byte { return p.v.Interface().(*[][]byte) }
|
||||
func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.v.Interface().(*WeakFields)) }
|
||||
func (p pointer) Extensions() *map[int32]ExtensionField {
|
||||
|
2
actions/retest/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
generated
vendored
2
actions/retest/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// 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 impl
|
||||
@ -109,6 +110,7 @@ func (p pointer) String() *string { return (*string)(p.p)
|
||||
func (p pointer) StringPtr() **string { return (**string)(p.p) }
|
||||
func (p pointer) StringSlice() *[]string { return (*[]string)(p.p) }
|
||||
func (p pointer) Bytes() *[]byte { return (*[]byte)(p.p) }
|
||||
func (p pointer) BytesPtr() **[]byte { return (**[]byte)(p.p) }
|
||||
func (p pointer) BytesSlice() *[][]byte { return (*[][]byte)(p.p) }
|
||||
func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.p) }
|
||||
func (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) }
|
||||
|
50
actions/retest/vendor/google.golang.org/protobuf/internal/impl/validate.go
generated
vendored
50
actions/retest/vendor/google.golang.org/protobuf/internal/impl/validate.go
generated
vendored
@ -16,9 +16,9 @@ import (
|
||||
"google.golang.org/protobuf/internal/flags"
|
||||
"google.golang.org/protobuf/internal/genid"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
preg "google.golang.org/protobuf/reflect/protoregistry"
|
||||
piface "google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// ValidationStatus is the result of validating the wire-format encoding of a message.
|
||||
@ -56,20 +56,20 @@ func (v ValidationStatus) String() string {
|
||||
// of the message type.
|
||||
//
|
||||
// This function is exposed for testing.
|
||||
func Validate(mt pref.MessageType, in piface.UnmarshalInput) (out piface.UnmarshalOutput, _ ValidationStatus) {
|
||||
func Validate(mt protoreflect.MessageType, in protoiface.UnmarshalInput) (out protoiface.UnmarshalOutput, _ ValidationStatus) {
|
||||
mi, ok := mt.(*MessageInfo)
|
||||
if !ok {
|
||||
return out, ValidationUnknown
|
||||
}
|
||||
if in.Resolver == nil {
|
||||
in.Resolver = preg.GlobalTypes
|
||||
in.Resolver = protoregistry.GlobalTypes
|
||||
}
|
||||
o, st := mi.validate(in.Buf, 0, unmarshalOptions{
|
||||
flags: in.Flags,
|
||||
resolver: in.Resolver,
|
||||
})
|
||||
if o.initialized {
|
||||
out.Flags |= piface.UnmarshalInitialized
|
||||
out.Flags |= protoiface.UnmarshalInitialized
|
||||
}
|
||||
return out, st
|
||||
}
|
||||
@ -106,22 +106,22 @@ const (
|
||||
validationTypeMessageSetItem
|
||||
)
|
||||
|
||||
func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||
func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||
var vi validationInfo
|
||||
switch {
|
||||
case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
|
||||
switch fd.Kind() {
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
vi.typ = validationTypeMessage
|
||||
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
||||
vi.mi = getMessageInfo(ot.Field(0).Type)
|
||||
}
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
vi.typ = validationTypeGroup
|
||||
if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
|
||||
vi.mi = getMessageInfo(ot.Field(0).Type)
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if strs.EnforceUTF8(fd) {
|
||||
vi.typ = validationTypeUTF8String
|
||||
}
|
||||
@ -129,7 +129,7 @@ func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescrip
|
||||
default:
|
||||
vi = newValidationInfo(fd, ft)
|
||||
}
|
||||
if fd.Cardinality() == pref.Required {
|
||||
if fd.Cardinality() == protoreflect.Required {
|
||||
// Avoid overflow. The required field check is done with a 64-bit mask, with
|
||||
// any message containing more than 64 required fields always reported as
|
||||
// potentially uninitialized, so it is not important to get a precise count
|
||||
@ -142,22 +142,22 @@ func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescrip
|
||||
return vi
|
||||
}
|
||||
|
||||
func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||
func newValidationInfo(fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
|
||||
var vi validationInfo
|
||||
switch {
|
||||
case fd.IsList():
|
||||
switch fd.Kind() {
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
vi.typ = validationTypeMessage
|
||||
if ft.Kind() == reflect.Slice {
|
||||
vi.mi = getMessageInfo(ft.Elem())
|
||||
}
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
vi.typ = validationTypeGroup
|
||||
if ft.Kind() == reflect.Slice {
|
||||
vi.mi = getMessageInfo(ft.Elem())
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
vi.typ = validationTypeBytes
|
||||
if strs.EnforceUTF8(fd) {
|
||||
vi.typ = validationTypeUTF8String
|
||||
@ -175,33 +175,33 @@ func newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo
|
||||
case fd.IsMap():
|
||||
vi.typ = validationTypeMap
|
||||
switch fd.MapKey().Kind() {
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if strs.EnforceUTF8(fd) {
|
||||
vi.keyType = validationTypeUTF8String
|
||||
}
|
||||
}
|
||||
switch fd.MapValue().Kind() {
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
vi.valType = validationTypeMessage
|
||||
if ft.Kind() == reflect.Map {
|
||||
vi.mi = getMessageInfo(ft.Elem())
|
||||
}
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
if strs.EnforceUTF8(fd) {
|
||||
vi.valType = validationTypeUTF8String
|
||||
}
|
||||
}
|
||||
default:
|
||||
switch fd.Kind() {
|
||||
case pref.MessageKind:
|
||||
case protoreflect.MessageKind:
|
||||
vi.typ = validationTypeMessage
|
||||
if !fd.IsWeak() {
|
||||
vi.mi = getMessageInfo(ft)
|
||||
}
|
||||
case pref.GroupKind:
|
||||
case protoreflect.GroupKind:
|
||||
vi.typ = validationTypeGroup
|
||||
vi.mi = getMessageInfo(ft)
|
||||
case pref.StringKind:
|
||||
case protoreflect.StringKind:
|
||||
vi.typ = validationTypeBytes
|
||||
if strs.EnforceUTF8(fd) {
|
||||
vi.typ = validationTypeUTF8String
|
||||
@ -314,11 +314,11 @@ State:
|
||||
break
|
||||
}
|
||||
messageName := fd.Message().FullName()
|
||||
messageType, err := preg.GlobalTypes.FindMessageByName(messageName)
|
||||
messageType, err := protoregistry.GlobalTypes.FindMessageByName(messageName)
|
||||
switch err {
|
||||
case nil:
|
||||
vi.mi, _ = messageType.(*MessageInfo)
|
||||
case preg.NotFound:
|
||||
case protoregistry.NotFound:
|
||||
vi.typ = validationTypeBytes
|
||||
default:
|
||||
return out, ValidationUnknown
|
||||
@ -335,7 +335,7 @@ State:
|
||||
// unmarshaling to begin failing. Supporting this requires some way to
|
||||
// determine if the resolver is frozen.
|
||||
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)
|
||||
if err != nil && err != preg.NotFound {
|
||||
if err != nil && err != protoregistry.NotFound {
|
||||
return out, ValidationUnknown
|
||||
}
|
||||
if err == nil {
|
||||
@ -513,7 +513,7 @@ State:
|
||||
}
|
||||
xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)
|
||||
switch {
|
||||
case err == preg.NotFound:
|
||||
case err == protoregistry.NotFound:
|
||||
b = b[n:]
|
||||
case err != nil:
|
||||
return out, ValidationUnknown
|
||||
|
16
actions/retest/vendor/google.golang.org/protobuf/internal/impl/weak.go
generated
vendored
16
actions/retest/vendor/google.golang.org/protobuf/internal/impl/weak.go
generated
vendored
@ -7,7 +7,7 @@ package impl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
)
|
||||
|
||||
@ -17,32 +17,32 @@ import (
|
||||
// defined directly on it.
|
||||
type weakFields WeakFields
|
||||
|
||||
func (w weakFields) get(num pref.FieldNumber) (pref.ProtoMessage, bool) {
|
||||
func (w weakFields) get(num protoreflect.FieldNumber) (protoreflect.ProtoMessage, bool) {
|
||||
m, ok := w[int32(num)]
|
||||
return m, ok
|
||||
}
|
||||
|
||||
func (w *weakFields) set(num pref.FieldNumber, m pref.ProtoMessage) {
|
||||
func (w *weakFields) set(num protoreflect.FieldNumber, m protoreflect.ProtoMessage) {
|
||||
if *w == nil {
|
||||
*w = make(weakFields)
|
||||
}
|
||||
(*w)[int32(num)] = m
|
||||
}
|
||||
|
||||
func (w *weakFields) clear(num pref.FieldNumber) {
|
||||
func (w *weakFields) clear(num protoreflect.FieldNumber) {
|
||||
delete(*w, int32(num))
|
||||
}
|
||||
|
||||
func (Export) HasWeak(w WeakFields, num pref.FieldNumber) bool {
|
||||
func (Export) HasWeak(w WeakFields, num protoreflect.FieldNumber) bool {
|
||||
_, ok := w[int32(num)]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (Export) ClearWeak(w *WeakFields, num pref.FieldNumber) {
|
||||
func (Export) ClearWeak(w *WeakFields, num protoreflect.FieldNumber) {
|
||||
delete(*w, int32(num))
|
||||
}
|
||||
|
||||
func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pref.ProtoMessage {
|
||||
func (Export) GetWeak(w WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName) protoreflect.ProtoMessage {
|
||||
if m, ok := w[int32(num)]; ok {
|
||||
return m
|
||||
}
|
||||
@ -53,7 +53,7 @@ func (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pr
|
||||
return mt.Zero().Interface()
|
||||
}
|
||||
|
||||
func (Export) SetWeak(w *WeakFields, num pref.FieldNumber, name pref.FullName, m pref.ProtoMessage) {
|
||||
func (Export) SetWeak(w *WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName, m protoreflect.ProtoMessage) {
|
||||
if m != nil {
|
||||
mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
|
||||
if mt == nil {
|
||||
|
43
actions/retest/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go
generated
vendored
43
actions/retest/vendor/google.golang.org/protobuf/internal/mapsort/mapsort.go
generated
vendored
@ -1,43 +0,0 @@
|
||||
// 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 mapsort provides sorted access to maps.
|
||||
package mapsort
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// Range iterates over every map entry in sorted key order,
|
||||
// calling f for each key and value encountered.
|
||||
func Range(mapv protoreflect.Map, keyKind protoreflect.Kind, f func(protoreflect.MapKey, protoreflect.Value) bool) {
|
||||
var keys []protoreflect.MapKey
|
||||
mapv.Range(func(key protoreflect.MapKey, _ protoreflect.Value) bool {
|
||||
keys = append(keys, key)
|
||||
return true
|
||||
})
|
||||
sort.Slice(keys, func(i, j int) bool {
|
||||
switch keyKind {
|
||||
case protoreflect.BoolKind:
|
||||
return !keys[i].Bool() && keys[j].Bool()
|
||||
case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind,
|
||||
protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
|
||||
return keys[i].Int() < keys[j].Int()
|
||||
case protoreflect.Uint32Kind, protoreflect.Fixed32Kind,
|
||||
protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
|
||||
return keys[i].Uint() < keys[j].Uint()
|
||||
case protoreflect.StringKind:
|
||||
return keys[i].String() < keys[j].String()
|
||||
default:
|
||||
panic("invalid kind: " + keyKind.String())
|
||||
}
|
||||
})
|
||||
for _, key := range keys {
|
||||
if !f(key, mapv.Get(key)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
89
actions/retest/vendor/google.golang.org/protobuf/internal/order/order.go
generated
vendored
Normal file
89
actions/retest/vendor/google.golang.org/protobuf/internal/order/order.go
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
// Copyright 2020 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 order
|
||||
|
||||
import (
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// FieldOrder specifies the ordering to visit message fields.
|
||||
// It is a function that reports whether x is ordered before y.
|
||||
type FieldOrder func(x, y protoreflect.FieldDescriptor) bool
|
||||
|
||||
var (
|
||||
// AnyFieldOrder specifies no specific field ordering.
|
||||
AnyFieldOrder FieldOrder = nil
|
||||
|
||||
// LegacyFieldOrder sorts fields in the same ordering as emitted by
|
||||
// wire serialization in the github.com/golang/protobuf implementation.
|
||||
LegacyFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||
ox, oy := x.ContainingOneof(), y.ContainingOneof()
|
||||
inOneof := func(od protoreflect.OneofDescriptor) bool {
|
||||
return od != nil && !od.IsSynthetic()
|
||||
}
|
||||
|
||||
// Extension fields sort before non-extension fields.
|
||||
if x.IsExtension() != y.IsExtension() {
|
||||
return x.IsExtension() && !y.IsExtension()
|
||||
}
|
||||
// Fields not within a oneof sort before those within a oneof.
|
||||
if inOneof(ox) != inOneof(oy) {
|
||||
return !inOneof(ox) && inOneof(oy)
|
||||
}
|
||||
// Fields in disjoint oneof sets are sorted by declaration index.
|
||||
if ox != nil && oy != nil && ox != oy {
|
||||
return ox.Index() < oy.Index()
|
||||
}
|
||||
// Fields sorted by field number.
|
||||
return x.Number() < y.Number()
|
||||
}
|
||||
|
||||
// NumberFieldOrder sorts fields by their field number.
|
||||
NumberFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||
return x.Number() < y.Number()
|
||||
}
|
||||
|
||||
// IndexNameFieldOrder sorts non-extension fields before extension fields.
|
||||
// Non-extensions are sorted according to their declaration index.
|
||||
// Extensions are sorted according to their full name.
|
||||
IndexNameFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
|
||||
// Non-extension fields sort before extension fields.
|
||||
if x.IsExtension() != y.IsExtension() {
|
||||
return !x.IsExtension() && y.IsExtension()
|
||||
}
|
||||
// Extensions sorted by fullname.
|
||||
if x.IsExtension() && y.IsExtension() {
|
||||
return x.FullName() < y.FullName()
|
||||
}
|
||||
// Non-extensions sorted by declaration index.
|
||||
return x.Index() < y.Index()
|
||||
}
|
||||
)
|
||||
|
||||
// KeyOrder specifies the ordering to visit map entries.
|
||||
// It is a function that reports whether x is ordered before y.
|
||||
type KeyOrder func(x, y protoreflect.MapKey) bool
|
||||
|
||||
var (
|
||||
// AnyKeyOrder specifies no specific key ordering.
|
||||
AnyKeyOrder KeyOrder = nil
|
||||
|
||||
// GenericKeyOrder sorts false before true, numeric keys in ascending order,
|
||||
// and strings in lexicographical ordering according to UTF-8 codepoints.
|
||||
GenericKeyOrder KeyOrder = func(x, y protoreflect.MapKey) bool {
|
||||
switch x.Interface().(type) {
|
||||
case bool:
|
||||
return !x.Bool() && y.Bool()
|
||||
case int32, int64:
|
||||
return x.Int() < y.Int()
|
||||
case uint32, uint64:
|
||||
return x.Uint() < y.Uint()
|
||||
case string:
|
||||
return x.String() < y.String()
|
||||
default:
|
||||
panic("invalid map key type")
|
||||
}
|
||||
}
|
||||
)
|
115
actions/retest/vendor/google.golang.org/protobuf/internal/order/range.go
generated
vendored
Normal file
115
actions/retest/vendor/google.golang.org/protobuf/internal/order/range.go
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
// Copyright 2020 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 order provides ordered access to messages and maps.
|
||||
package order
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type messageField struct {
|
||||
fd protoreflect.FieldDescriptor
|
||||
v protoreflect.Value
|
||||
}
|
||||
|
||||
var messageFieldPool = sync.Pool{
|
||||
New: func() interface{} { return new([]messageField) },
|
||||
}
|
||||
|
||||
type (
|
||||
// FieldRnger is an interface for visiting all fields in a message.
|
||||
// The protoreflect.Message type implements this interface.
|
||||
FieldRanger interface{ Range(VisitField) }
|
||||
// VisitField is called every time a message field is visited.
|
||||
VisitField = func(protoreflect.FieldDescriptor, protoreflect.Value) bool
|
||||
)
|
||||
|
||||
// RangeFields iterates over the fields of fs according to the specified order.
|
||||
func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
|
||||
if less == nil {
|
||||
fs.Range(fn)
|
||||
return
|
||||
}
|
||||
|
||||
// Obtain a pre-allocated scratch buffer.
|
||||
p := messageFieldPool.Get().(*[]messageField)
|
||||
fields := (*p)[:0]
|
||||
defer func() {
|
||||
if cap(fields) < 1024 {
|
||||
*p = fields
|
||||
messageFieldPool.Put(p)
|
||||
}
|
||||
}()
|
||||
|
||||
// Collect all fields in the message and sort them.
|
||||
fs.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
||||
fields = append(fields, messageField{fd, v})
|
||||
return true
|
||||
})
|
||||
sort.Slice(fields, func(i, j int) bool {
|
||||
return less(fields[i].fd, fields[j].fd)
|
||||
})
|
||||
|
||||
// Visit the fields in the specified ordering.
|
||||
for _, f := range fields {
|
||||
if !fn(f.fd, f.v) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type mapEntry struct {
|
||||
k protoreflect.MapKey
|
||||
v protoreflect.Value
|
||||
}
|
||||
|
||||
var mapEntryPool = sync.Pool{
|
||||
New: func() interface{} { return new([]mapEntry) },
|
||||
}
|
||||
|
||||
type (
|
||||
// EntryRanger is an interface for visiting all fields in a message.
|
||||
// The protoreflect.Map type implements this interface.
|
||||
EntryRanger interface{ Range(VisitEntry) }
|
||||
// VisitEntry is called every time a map entry is visited.
|
||||
VisitEntry = func(protoreflect.MapKey, protoreflect.Value) bool
|
||||
)
|
||||
|
||||
// RangeEntries iterates over the entries of es according to the specified order.
|
||||
func RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {
|
||||
if less == nil {
|
||||
es.Range(fn)
|
||||
return
|
||||
}
|
||||
|
||||
// Obtain a pre-allocated scratch buffer.
|
||||
p := mapEntryPool.Get().(*[]mapEntry)
|
||||
entries := (*p)[:0]
|
||||
defer func() {
|
||||
if cap(entries) < 1024 {
|
||||
*p = entries
|
||||
mapEntryPool.Put(p)
|
||||
}
|
||||
}()
|
||||
|
||||
// Collect all entries in the map and sort them.
|
||||
es.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
|
||||
entries = append(entries, mapEntry{k, v})
|
||||
return true
|
||||
})
|
||||
sort.Slice(entries, func(i, j int) bool {
|
||||
return less(entries[i].k, entries[j].k)
|
||||
})
|
||||
|
||||
// Visit the entries in the specified ordering.
|
||||
for _, e := range entries {
|
||||
if !fn(e.k, e.v) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
1
actions/retest/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
generated
vendored
1
actions/retest/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// 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 strs
|
||||
|
7
actions/retest/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go
generated
vendored
7
actions/retest/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go
generated
vendored
@ -2,6 +2,7 @@
|
||||
// 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 strs
|
||||
@ -9,7 +10,7 @@ package strs
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
pref "google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -58,7 +59,7 @@ type Builder struct {
|
||||
|
||||
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
||||
// but optimized for large batches where each name has a shared lifetime.
|
||||
func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {
|
||||
func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
|
||||
n := len(prefix) + len(".") + len(name)
|
||||
if len(prefix) == 0 {
|
||||
n -= len(".")
|
||||
@ -67,7 +68,7 @@ func (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.Ful
|
||||
sb.buf = append(sb.buf, prefix...)
|
||||
sb.buf = append(sb.buf, '.')
|
||||
sb.buf = append(sb.buf, name...)
|
||||
return pref.FullName(sb.last(n))
|
||||
return protoreflect.FullName(sb.last(n))
|
||||
}
|
||||
|
||||
// MakeString is equivalent to string(b), but optimized for large batches
|
||||
|
56
actions/retest/vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
56
actions/retest/vendor/google.golang.org/protobuf/internal/version/version.go
generated
vendored
@ -12,54 +12,54 @@ import (
|
||||
|
||||
// These constants determine the current version of this module.
|
||||
//
|
||||
//
|
||||
// For our release process, we enforce the following rules:
|
||||
// * Tagged releases use a tag that is identical to String.
|
||||
// * Tagged releases never reference a commit where the String
|
||||
// contains "devel".
|
||||
// * The set of all commits in this repository where String
|
||||
// does not contain "devel" must have a unique String.
|
||||
//
|
||||
// - Tagged releases use a tag that is identical to String.
|
||||
// - Tagged releases never reference a commit where the String
|
||||
// contains "devel".
|
||||
// - The set of all commits in this repository where String
|
||||
// does not contain "devel" must have a unique String.
|
||||
//
|
||||
// Steps for tagging a new release:
|
||||
// 1. Create a new CL.
|
||||
//
|
||||
// 2. Update Minor, Patch, and/or PreRelease as necessary.
|
||||
// PreRelease must not contain the string "devel".
|
||||
// 1. Create a new CL.
|
||||
//
|
||||
// 3. Since the last released minor version, have there been any changes to
|
||||
// generator that relies on new functionality in the runtime?
|
||||
// If yes, then increment RequiredGenerated.
|
||||
// 2. Update Minor, Patch, and/or PreRelease as necessary.
|
||||
// PreRelease must not contain the string "devel".
|
||||
//
|
||||
// 4. Since the last released minor version, have there been any changes to
|
||||
// the runtime that removes support for old .pb.go source code?
|
||||
// If yes, then increment SupportMinimum.
|
||||
// 3. Since the last released minor version, have there been any changes to
|
||||
// generator that relies on new functionality in the runtime?
|
||||
// If yes, then increment RequiredGenerated.
|
||||
//
|
||||
// 5. Send out the CL for review and submit it.
|
||||
// Note that the next CL in step 8 must be submitted after this CL
|
||||
// without any other CLs in-between.
|
||||
// 4. Since the last released minor version, have there been any changes to
|
||||
// the runtime that removes support for old .pb.go source code?
|
||||
// If yes, then increment SupportMinimum.
|
||||
//
|
||||
// 6. Tag a new version, where the tag is is the current String.
|
||||
// 5. Send out the CL for review and submit it.
|
||||
// Note that the next CL in step 8 must be submitted after this CL
|
||||
// without any other CLs in-between.
|
||||
//
|
||||
// 7. Write release notes for all notable changes
|
||||
// between this release and the last release.
|
||||
// 6. Tag a new version, where the tag is is the current String.
|
||||
//
|
||||
// 8. Create a new CL.
|
||||
// 7. Write release notes for all notable changes
|
||||
// between this release and the last release.
|
||||
//
|
||||
// 9. Update PreRelease to include the string "devel".
|
||||
// For example: "" -> "devel" or "rc.1" -> "rc.1.devel"
|
||||
// 8. Create a new CL.
|
||||
//
|
||||
// 10. Send out the CL for review and submit it.
|
||||
// 9. Update PreRelease to include the string "devel".
|
||||
// For example: "" -> "devel" or "rc.1" -> "rc.1.devel"
|
||||
//
|
||||
// 10. Send out the CL for review and submit it.
|
||||
const (
|
||||
Major = 1
|
||||
Minor = 25
|
||||
Patch = 0
|
||||
Minor = 28
|
||||
Patch = 1
|
||||
PreRelease = ""
|
||||
)
|
||||
|
||||
// String formats the version string for this module in semver format.
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// v1.20.1
|
||||
// v1.21.0-rc.1
|
||||
func String() string {
|
||||
|
Reference in New Issue
Block a user