forked from forgejo/forgejo
[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
157
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
157
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
|
@ -17,24 +17,49 @@ package protoregistry
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/internal/flags"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// conflictPolicy configures the policy for handling registration conflicts.
|
||||
//
|
||||
// It can be over-written at compile time with a linker-initialized variable:
|
||||
// go build -ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn"
|
||||
//
|
||||
// It can be over-written at program execution with an environment variable:
|
||||
// GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn ./main
|
||||
//
|
||||
// Neither of the above are covered by the compatibility promise and
|
||||
// may be removed in a future release of this module.
|
||||
var conflictPolicy = "panic" // "panic" | "warn" | "ignore"
|
||||
|
||||
// ignoreConflict reports whether to ignore a registration conflict
|
||||
// given the descriptor being registered and the error.
|
||||
// It is a variable so that the behavior is easily overridden in another file.
|
||||
var ignoreConflict = func(d protoreflect.Descriptor, err error) bool {
|
||||
log.Printf(""+
|
||||
"WARNING: %v\n"+
|
||||
"A future release will panic on registration conflicts. See:\n"+
|
||||
"https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict\n"+
|
||||
"\n", err)
|
||||
return true
|
||||
const env = "GOLANG_PROTOBUF_REGISTRATION_CONFLICT"
|
||||
const faq = "https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict"
|
||||
policy := conflictPolicy
|
||||
if v := os.Getenv(env); v != "" {
|
||||
policy = v
|
||||
}
|
||||
switch policy {
|
||||
case "panic":
|
||||
panic(fmt.Sprintf("%v\nSee %v\n", err, faq))
|
||||
case "warn":
|
||||
fmt.Fprintf(os.Stderr, "WARNING: %v\nSee %v\n\n", err, faq)
|
||||
return true
|
||||
case "ignore":
|
||||
return true
|
||||
default:
|
||||
panic("invalid " + env + " value: " + os.Getenv(env))
|
||||
}
|
||||
}
|
||||
|
||||
var globalMutex sync.RWMutex
|
||||
|
@ -96,38 +121,7 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
|||
}
|
||||
path := file.Path()
|
||||
if prev := r.filesByPath[path]; prev != nil {
|
||||
// TODO: Remove this after some soak-in period after moving these types.
|
||||
var prevPath string
|
||||
const prevModule = "google.golang.org/genproto"
|
||||
const prevVersion = "cb27e3aa (May 26th, 2020)"
|
||||
switch path {
|
||||
case "google/protobuf/field_mask.proto":
|
||||
prevPath = prevModule + "/protobuf/field_mask"
|
||||
case "google/protobuf/api.proto":
|
||||
prevPath = prevModule + "/protobuf/api"
|
||||
case "google/protobuf/type.proto":
|
||||
prevPath = prevModule + "/protobuf/ptype"
|
||||
case "google/protobuf/source_context.proto":
|
||||
prevPath = prevModule + "/protobuf/source_context"
|
||||
}
|
||||
if r == GlobalFiles && prevPath != "" {
|
||||
pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto")
|
||||
pkgName = strings.Replace(pkgName, "_", "", -1) + "pb"
|
||||
currPath := "google.golang.org/protobuf/types/known/" + pkgName
|
||||
panic(fmt.Sprintf(""+
|
||||
"duplicate registration of %q\n"+
|
||||
"\n"+
|
||||
"The generated definition for this file has moved:\n"+
|
||||
"\tfrom: %q\n"+
|
||||
"\tto: %q\n"+
|
||||
"A dependency on the %q module must\n"+
|
||||
"be at version %v or higher.\n"+
|
||||
"\n"+
|
||||
"Upgrade the dependency by running:\n"+
|
||||
"\tgo get -u %v\n",
|
||||
path, prevPath, currPath, prevModule, prevVersion, prevPath))
|
||||
}
|
||||
|
||||
r.checkGenProtoConflict(path)
|
||||
err := errors.New("file %q is already registered", file.Path())
|
||||
err = amendErrorWithCaller(err, prev, file)
|
||||
if r == GlobalFiles && ignoreConflict(file, err) {
|
||||
|
@ -178,6 +172,47 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Several well-known types were hosted in the google.golang.org/genproto module
|
||||
// but were later moved to this module. To avoid a weak dependency on the
|
||||
// genproto module (and its relatively large set of transitive dependencies),
|
||||
// we rely on a registration conflict to determine whether the genproto version
|
||||
// is too old (i.e., does not contain aliases to the new type declarations).
|
||||
func (r *Files) checkGenProtoConflict(path string) {
|
||||
if r != GlobalFiles {
|
||||
return
|
||||
}
|
||||
var prevPath string
|
||||
const prevModule = "google.golang.org/genproto"
|
||||
const prevVersion = "cb27e3aa (May 26th, 2020)"
|
||||
switch path {
|
||||
case "google/protobuf/field_mask.proto":
|
||||
prevPath = prevModule + "/protobuf/field_mask"
|
||||
case "google/protobuf/api.proto":
|
||||
prevPath = prevModule + "/protobuf/api"
|
||||
case "google/protobuf/type.proto":
|
||||
prevPath = prevModule + "/protobuf/ptype"
|
||||
case "google/protobuf/source_context.proto":
|
||||
prevPath = prevModule + "/protobuf/source_context"
|
||||
default:
|
||||
return
|
||||
}
|
||||
pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto")
|
||||
pkgName = strings.Replace(pkgName, "_", "", -1) + "pb" // e.g., "field_mask" => "fieldmaskpb"
|
||||
currPath := "google.golang.org/protobuf/types/known/" + pkgName
|
||||
panic(fmt.Sprintf(""+
|
||||
"duplicate registration of %q\n"+
|
||||
"\n"+
|
||||
"The generated definition for this file has moved:\n"+
|
||||
"\tfrom: %q\n"+
|
||||
"\tto: %q\n"+
|
||||
"A dependency on the %q module must\n"+
|
||||
"be at version %v or higher.\n"+
|
||||
"\n"+
|
||||
"Upgrade the dependency by running:\n"+
|
||||
"\tgo get -u %v\n",
|
||||
path, prevPath, currPath, prevModule, prevVersion, prevPath))
|
||||
}
|
||||
|
||||
// FindDescriptorByName looks up a descriptor by the full name.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
|
@ -560,13 +595,25 @@ func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumTyp
|
|||
return nil, NotFound
|
||||
}
|
||||
|
||||
// FindMessageByName looks up a message by its full name.
|
||||
// E.g., "google.protobuf.Any"
|
||||
// FindMessageByName looks up a message by its full name,
|
||||
// e.g. "google.protobuf.Any".
|
||||
//
|
||||
// This return (nil, NotFound) if not found.
|
||||
// This returns (nil, NotFound) if not found.
|
||||
func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {
|
||||
// The full name by itself is a valid URL.
|
||||
return r.FindMessageByURL(string(message))
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
}
|
||||
if r == GlobalTypes {
|
||||
globalMutex.RLock()
|
||||
defer globalMutex.RUnlock()
|
||||
}
|
||||
if v := r.typesByName[message]; v != nil {
|
||||
if mt, _ := v.(protoreflect.MessageType); mt != nil {
|
||||
return mt, nil
|
||||
}
|
||||
return nil, errors.New("found wrong type: got %v, want message", typeName(v))
|
||||
}
|
||||
return nil, NotFound
|
||||
}
|
||||
|
||||
// FindMessageByURL looks up a message by a URL identifier.
|
||||
|
@ -574,6 +621,8 @@ func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.M
|
|||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
||||
// This function is similar to FindMessageByName but
|
||||
// truncates anything before and including '/' in the URL.
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
}
|
||||
|
@ -613,6 +662,26 @@ func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.E
|
|||
if xt, _ := v.(protoreflect.ExtensionType); xt != nil {
|
||||
return xt, nil
|
||||
}
|
||||
|
||||
// MessageSet extensions are special in that the name of the extension
|
||||
// is the name of the message type used to extend the MessageSet.
|
||||
// This naming scheme is used by text and JSON serialization.
|
||||
//
|
||||
// This feature is protected by the ProtoLegacy flag since MessageSets
|
||||
// are a proto1 feature that is long deprecated.
|
||||
if flags.ProtoLegacy {
|
||||
if _, ok := v.(protoreflect.MessageType); ok {
|
||||
field := field.Append(messageset.ExtensionName)
|
||||
if v := r.typesByName[field]; v != nil {
|
||||
if xt, _ := v.(protoreflect.ExtensionType); xt != nil {
|
||||
if messageset.IsMessageSetExtension(xt.TypeDescriptor()) {
|
||||
return xt, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, errors.New("found wrong type: got %v, want extension", typeName(v))
|
||||
}
|
||||
return nil, NotFound
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue