Update dependencies (#5518)

This commit is contained in:
hongming
2023-02-12 23:09:20 +08:00
committed by GitHub
parent d3b35fb2da
commit a979342f56
1486 changed files with 126660 additions and 71128 deletions

26
vendor/go.uber.org/goleak/leaks.go generated vendored
View File

@@ -21,6 +21,7 @@
package goleak
import (
"errors"
"fmt"
"go.uber.org/goleak/internal/stack"
@@ -55,6 +56,9 @@ func Find(options ...Option) error {
cur := stack.Current().ID()
opts := buildOpts(options...)
if opts.cleanup != nil {
return errors.New("Cleanup can only be passed to VerifyNone or VerifyTestMain")
}
var stacks []stack.Stack
retry := true
for i := 0; retry; i++ {
@@ -69,12 +73,30 @@ func Find(options ...Option) error {
return fmt.Errorf("found unexpected goroutines:\n%s", stacks)
}
type testHelper interface {
Helper()
}
// VerifyNone marks the given TestingT as failed if any extra goroutines are
// found by Find. This is a helper method to make it easier to integrate in
// tests by doing:
// defer VerifyNone(t)
//
// defer VerifyNone(t)
func VerifyNone(t TestingT, options ...Option) {
if err := Find(options...); err != nil {
opts := buildOpts(options...)
var cleanup func(int)
cleanup, opts.cleanup = opts.cleanup, nil
if h, ok := t.(testHelper); ok {
// Mark this function as a test helper, if available.
h.Helper()
}
if err := Find(opts); err != nil {
t.Error(err)
}
if cleanup != nil {
cleanup(0)
}
}