summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-09-06 17:37:53 +0200
committerGitHub <noreply@github.com>2020-09-06 11:37:53 -0400
commit0c6a8027315e704011bacb7bfd8158fe36470cda (patch)
tree8d73f8fa429ee0e8b2ddb1e6609be8460f0dd01d /vendor/golang.org
parent0ed5e103fef5986fcbbb7c208cc015727f4a79dd (diff)
downloadgitea-0c6a8027315e704011bacb7bfd8158fe36470cda.tar.gz
gitea-0c6a8027315e704011bacb7bfd8158fe36470cda.zip
[Vendor] Update xanzy/go-gitlab v0.31.0 => v0.37.0 (#12701)
* update github.com/xanzy/go-gitlab v0.31.0 => v0.37.0 * vendor * adapt changes Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'vendor/golang.org')
-rw-r--r--vendor/golang.org/x/time/rate/rate.go10
-rw-r--r--vendor/golang.org/x/tools/internal/analysisinternal/analysis.go6
-rw-r--r--vendor/golang.org/x/tools/internal/imports/fix.go33
3 files changed, 42 insertions, 7 deletions
diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go
index a114b1aa50..a98fe77827 100644
--- a/vendor/golang.org/x/time/rate/rate.go
+++ b/vendor/golang.org/x/time/rate/rate.go
@@ -53,10 +53,9 @@ func Every(interval time.Duration) Limit {
//
// The methods AllowN, ReserveN, and WaitN consume n tokens.
type Limiter struct {
- limit Limit
- burst int
-
mu sync.Mutex
+ limit Limit
+ burst int
tokens float64
// last is the last time the limiter's tokens field was updated
last time.Time
@@ -76,6 +75,8 @@ func (lim *Limiter) Limit() Limit {
// Burst values allow more events to happen at once.
// A zero Burst allows no events, unless limit == Inf.
func (lim *Limiter) Burst() int {
+ lim.mu.Lock()
+ defer lim.mu.Unlock()
return lim.burst
}
@@ -229,7 +230,7 @@ func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) {
lim.mu.Unlock()
if n > burst && limit != Inf {
- return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, lim.burst)
+ return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, burst)
}
// Check if ctx is already cancelled
select {
@@ -359,6 +360,7 @@ func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duratio
// advance calculates and returns an updated state for lim resulting from the passage of time.
// lim is not changed.
+// advance requires that lim.mu is held.
func (lim *Limiter) advance(now time.Time) (newNow time.Time, newLast time.Time, newTokens float64) {
last := lim.last
if now.Before(last) {
diff --git a/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go b/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go
index e25f4a4096..54a6992a12 100644
--- a/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go
+++ b/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go
@@ -198,8 +198,12 @@ func TypeExpr(fset *token.FileSet, f *ast.File, pkg *types.Package, typ types.Ty
X: ast.NewIdent(pkgName),
Sel: ast.NewIdent(t.Obj().Name()),
}
+ case *types.Struct:
+ return ast.NewIdent(t.String())
+ case *types.Interface:
+ return ast.NewIdent(t.String())
default:
- return nil // TODO: anonymous structs, but who does that
+ return nil
}
}
diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go
index 0cb09e26a9..62d9fe86a0 100644
--- a/vendor/golang.org/x/tools/internal/imports/fix.go
+++ b/vendor/golang.org/x/tools/internal/imports/fix.go
@@ -693,8 +693,8 @@ func candidateImportName(pkg *pkg) string {
return ""
}
-// GetAllCandidates gets all of the packages starting with prefix that can be
-// imported by filename, sorted by import path.
+// GetAllCandidates calls wrapped for each package whose name starts with
+// searchPrefix, and can be imported from filename with the package name filePkg.
func GetAllCandidates(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error {
callback := &scanCallback{
rootFound: func(gopathwalk.Root) bool {
@@ -728,6 +728,35 @@ func GetAllCandidates(ctx context.Context, wrapped func(ImportFix), searchPrefix
return getCandidatePkgs(ctx, callback, filename, filePkg, env)
}
+// GetImportPaths calls wrapped for each package whose import path starts with
+// searchPrefix, and can be imported from filename with the package name filePkg.
+func GetImportPaths(ctx context.Context, wrapped func(ImportFix), searchPrefix, filename, filePkg string, env *ProcessEnv) error {
+ callback := &scanCallback{
+ rootFound: func(gopathwalk.Root) bool {
+ return true
+ },
+ dirFound: func(pkg *pkg) bool {
+ if !canUse(filename, pkg.dir) {
+ return false
+ }
+ return strings.HasPrefix(pkg.importPathShort, searchPrefix)
+ },
+ packageNameLoaded: func(pkg *pkg) bool {
+ wrapped(ImportFix{
+ StmtInfo: ImportInfo{
+ ImportPath: pkg.importPathShort,
+ Name: candidateImportName(pkg),
+ },
+ IdentName: pkg.packageName,
+ FixType: AddImport,
+ Relevance: pkg.relevance,
+ })
+ return false
+ },
+ }
+ return getCandidatePkgs(ctx, callback, filename, filePkg, env)
+}
+
// A PackageExport is a package and its exports.
type PackageExport struct {
Fix *ImportFix