[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3 * github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0 * github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2 * github.com/go-chi/cors v1.1.1 -> v1.2.0 * github.com/go-git/go-billy v5.0.0 -> v5.1.0 * github.com/go-git/go-git v5.2.0 -> v5.3.0 * github.com/go-ldap/ldap v3.2.4 -> v3.3.0 * github.com/go-redis/redis v8.6.0 -> v8.8.2 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0 * github.com/lib/pq v1.9.0 -> v1.10.1 * github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7 * github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0 * github.com/issue9/identicon v1.0.1 -> v1.2.0 * github.com/klauspost/compress v1.11.8 -> v1.12.1 * github.com/mgechev/revive v1.0.3 -> v1.0.6 * github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8 * github.com/niklasfasching/go-org v1.4.0 -> v1.5.0 * github.com/olivere/elastic v7.0.22 -> v7.0.24 * github.com/pelletier/go-toml v1.8.1 -> v1.9.0 * github.com/prometheus/client_golang v1.9.0 -> v1.10.0 * github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0 * github.com/yuin/goldmark v1.3.3 -> v1.3.5 * github.com/6543/go-version v1.2.4 -> v1.3.1 * do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
This commit is contained in:
parent
834fc74873
commit
792b4dba2c
558 changed files with 32080 additions and 24669 deletions
122
vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
122
vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
generated
vendored
|
@ -24,14 +24,24 @@ import (
|
|||
// 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 {
|
||||
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 pref.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,
|
||||
|
@ -49,8 +59,9 @@ 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
|
||||
|
@ -59,10 +70,10 @@ func legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {
|
|||
// calling Marshal methods when present.
|
||||
mi.methods.Flags |= piface.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,7 +86,7 @@ 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 {
|
||||
|
@ -114,17 +125,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,7 +383,7 @@ type legacyMerger interface {
|
|||
Merge(protoiface.MessageV1)
|
||||
}
|
||||
|
||||
var legacyProtoMethods = &piface.Methods{
|
||||
var aberrantProtoMethods = &piface.Methods{
|
||||
Marshal: legacyMarshal,
|
||||
Unmarshal: legacyUnmarshal,
|
||||
Merge: legacyMerge,
|
||||
|
@ -401,18 +414,40 @@ func legacyUnmarshal(in piface.UnmarshalInput) (piface.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 piface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
|
||||
}
|
||||
return piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
|
||||
}
|
||||
|
||||
func legacyMerge(in piface.MergeInput) piface.MergeOutput {
|
||||
// Check whether this supports the legacy merger.
|
||||
dstv := in.Destination.(unwrapper).protoUnwrap()
|
||||
merger, ok := dstv.(legacyMerger)
|
||||
if ok {
|
||||
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 piface.MergeOutput{}
|
||||
}
|
||||
merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
|
||||
dstv = in.Destination.(unwrapper).protoUnwrap()
|
||||
unmarshaler, ok := dstv.(legacyUnmarshaler)
|
||||
if !ok {
|
||||
return piface.MergeOutput{}
|
||||
}
|
||||
b, err := marshaler.Marshal()
|
||||
if err != nil {
|
||||
return piface.MergeOutput{}
|
||||
}
|
||||
err = unmarshaler.Unmarshal(b)
|
||||
if err != nil {
|
||||
return piface.MergeOutput{}
|
||||
}
|
||||
return piface.MergeOutput{Flags: piface.MergeComplete}
|
||||
}
|
||||
|
||||
|
@ -422,6 +457,9 @@ type aberrantMessageType struct {
|
|||
}
|
||||
|
||||
func (mt aberrantMessageType) New() pref.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 {
|
||||
|
@ -443,6 +481,17 @@ type aberrantMessage struct {
|
|||
v reflect.Value
|
||||
}
|
||||
|
||||
// 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() pref.Message {
|
||||
return m
|
||||
}
|
||||
|
@ -454,33 +503,40 @@ func (m aberrantMessage) Type() pref.MessageType {
|
|||
return aberrantMessageType{m.v.Type()}
|
||||
}
|
||||
func (m aberrantMessage) New() pref.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 {
|
||||
return m
|
||||
}
|
||||
func (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {
|
||||
return
|
||||
}
|
||||
func (m aberrantMessage) Has(pref.FieldDescriptor) bool {
|
||||
panic("invalid field descriptor")
|
||||
return false
|
||||
}
|
||||
func (m aberrantMessage) Clear(pref.FieldDescriptor) {
|
||||
panic("invalid field descriptor")
|
||||
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 pref.FieldDescriptor) pref.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")
|
||||
panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {
|
||||
panic("invalid field descriptor")
|
||||
panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {
|
||||
panic("invalid field descriptor")
|
||||
panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {
|
||||
panic("invalid oneof descriptor")
|
||||
panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
|
||||
}
|
||||
func (m aberrantMessage) GetUnknown() pref.RawFields {
|
||||
return nil
|
||||
|
@ -489,13 +545,13 @@ func (m aberrantMessage) SetUnknown(pref.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
|
||||
return aberrantProtoMethods
|
||||
}
|
||||
func (m aberrantMessage) protoUnwrap() interface{} {
|
||||
return m.v.Interface()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue