aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/go.uber.org/goleak
diff options
context:
space:
mode:
authoruzhas <uzhas@ydb.tech>2023-11-16 16:04:50 +0300
committeruzhas <uzhas@ydb.tech>2023-11-16 17:46:46 +0300
commit46f0c0079bb50609d2eeb6586642bcf114fc5239 (patch)
tree84e4e4978d57fe5de321ba69bf9d0c290de60a66 /vendor/go.uber.org/goleak
parent73045e389397816cc2bdd6cd7818b4bce427b265 (diff)
downloadydb-46f0c0079bb50609d2eeb6586642bcf114fc5239.tar.gz
enable ya make for go projects
Diffstat (limited to 'vendor/go.uber.org/goleak')
-rw-r--r--vendor/go.uber.org/goleak/doc.go22
-rw-r--r--vendor/go.uber.org/goleak/internal/stack/doc.go22
-rw-r--r--vendor/go.uber.org/goleak/internal/stack/stacks.go155
-rw-r--r--vendor/go.uber.org/goleak/internal/stack/ya.make14
-rw-r--r--vendor/go.uber.org/goleak/leaks.go102
-rw-r--r--vendor/go.uber.org/goleak/options.go178
-rw-r--r--vendor/go.uber.org/goleak/testmain.go69
-rw-r--r--vendor/go.uber.org/goleak/tracestack_new.go34
-rw-r--r--vendor/go.uber.org/goleak/ya.make27
9 files changed, 623 insertions, 0 deletions
diff --git a/vendor/go.uber.org/goleak/doc.go b/vendor/go.uber.org/goleak/doc.go
new file mode 100644
index 0000000000..3832f8dbc5
--- /dev/null
+++ b/vendor/go.uber.org/goleak/doc.go
@@ -0,0 +1,22 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// Package goleak is a Goroutine leak detector.
+package goleak // import "go.uber.org/goleak"
diff --git a/vendor/go.uber.org/goleak/internal/stack/doc.go b/vendor/go.uber.org/goleak/internal/stack/doc.go
new file mode 100644
index 0000000000..9179a56549
--- /dev/null
+++ b/vendor/go.uber.org/goleak/internal/stack/doc.go
@@ -0,0 +1,22 @@
+// Copyright (c) 2017-2023 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// Package stack is used for parsing stacks from `runtime.Stack`.
+package stack
diff --git a/vendor/go.uber.org/goleak/internal/stack/stacks.go b/vendor/go.uber.org/goleak/internal/stack/stacks.go
new file mode 100644
index 0000000000..94f82e4c0d
--- /dev/null
+++ b/vendor/go.uber.org/goleak/internal/stack/stacks.go
@@ -0,0 +1,155 @@
+// Copyright (c) 2017 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package stack
+
+import (
+ "bufio"
+ "bytes"
+ "fmt"
+ "io"
+ "runtime"
+ "strconv"
+ "strings"
+)
+
+const _defaultBufferSize = 64 * 1024 // 64 KiB
+
+// Stack represents a single Goroutine's stack.
+type Stack struct {
+ id int
+ state string
+ firstFunction string
+ fullStack *bytes.Buffer
+}
+
+// ID returns the goroutine ID.
+func (s Stack) ID() int {
+ return s.id
+}
+
+// State returns the Goroutine's state.
+func (s Stack) State() string {
+ return s.state
+}
+
+// Full returns the full stack trace for this goroutine.
+func (s Stack) Full() string {
+ return s.fullStack.String()
+}
+
+// FirstFunction returns the name of the first function on the stack.
+func (s Stack) FirstFunction() string {
+ return s.firstFunction
+}
+
+func (s Stack) String() string {
+ return fmt.Sprintf(
+ "Goroutine %v in state %v, with %v on top of the stack:\n%s",
+ s.id, s.state, s.firstFunction, s.Full())
+}
+
+func getStacks(all bool) []Stack {
+ var stacks []Stack
+
+ var curStack *Stack
+ stackReader := bufio.NewReader(bytes.NewReader(getStackBuffer(all)))
+ for {
+ line, err := stackReader.ReadString('\n')
+ if err == io.EOF {
+ break
+ }
+ if err != nil {
+ // We're reading using bytes.NewReader which should never fail.
+ panic("bufio.NewReader failed on a fixed string")
+ }
+
+ // If we see the goroutine header, start a new stack.
+ isFirstLine := false
+ if strings.HasPrefix(line, "goroutine ") {
+ // flush any previous stack
+ if curStack != nil {
+ stacks = append(stacks, *curStack)
+ }
+ id, goState := parseGoStackHeader(line)
+ curStack = &Stack{
+ id: id,
+ state: goState,
+ fullStack: &bytes.Buffer{},
+ }
+ isFirstLine = true
+ }
+ curStack.fullStack.WriteString(line)
+ if !isFirstLine && curStack.firstFunction == "" {
+ curStack.firstFunction = parseFirstFunc(line)
+ }
+ }
+
+ if curStack != nil {
+ stacks = append(stacks, *curStack)
+ }
+ return stacks
+}
+
+// All returns the stacks for all running goroutines.
+func All() []Stack {
+ return getStacks(true)
+}
+
+// Current returns the stack for the current goroutine.
+func Current() Stack {
+ return getStacks(false)[0]
+}
+
+func getStackBuffer(all bool) []byte {
+ for i := _defaultBufferSize; ; i *= 2 {
+ buf := make([]byte, i)
+ if n := runtime.Stack(buf, all); n < i {
+ return buf[:n]
+ }
+ }
+}
+
+func parseFirstFunc(line string) string {
+ line = strings.TrimSpace(line)
+ if idx := strings.LastIndex(line, "("); idx > 0 {
+ return line[:idx]
+ }
+ panic(fmt.Sprintf("function calls missing parents: %q", line))
+}
+
+// parseGoStackHeader parses a stack header that looks like:
+// goroutine 643 [runnable]:\n
+// And returns the goroutine ID, and the state.
+func parseGoStackHeader(line string) (goroutineID int, state string) {
+ line = strings.TrimSuffix(line, ":\n")
+ parts := strings.SplitN(line, " ", 3)
+ if len(parts) != 3 {
+ panic(fmt.Sprintf("unexpected stack header format: %q", line))
+ }
+
+ id, err := strconv.Atoi(parts[1])
+ if err != nil {
+ panic(fmt.Sprintf("failed to parse goroutine ID: %v in line %q", parts[1], line))
+ }
+
+ state = strings.TrimSuffix(strings.TrimPrefix(parts[2], "["), "]")
+ return id, state
+}
diff --git a/vendor/go.uber.org/goleak/internal/stack/ya.make b/vendor/go.uber.org/goleak/internal/stack/ya.make
new file mode 100644
index 0000000000..231f1661d1
--- /dev/null
+++ b/vendor/go.uber.org/goleak/internal/stack/ya.make
@@ -0,0 +1,14 @@
+GO_LIBRARY()
+
+LICENSE(MIT)
+
+SRCS(
+ doc.go
+ stacks.go
+)
+
+GO_TEST_SRCS(stacks_test.go)
+
+END()
+
+RECURSE(gotest)
diff --git a/vendor/go.uber.org/goleak/leaks.go b/vendor/go.uber.org/goleak/leaks.go
new file mode 100644
index 0000000000..ee122b7464
--- /dev/null
+++ b/vendor/go.uber.org/goleak/leaks.go
@@ -0,0 +1,102 @@
+// Copyright (c) 2017 Uber Technologies, Inc.
+
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package goleak
+
+import (
+ "errors"
+ "fmt"
+
+ "go.uber.org/goleak/internal/stack"
+)
+
+// TestingT is the minimal subset of testing.TB that we use.
+type TestingT interface {
+ Error(...interface{})
+}
+
+// filterStacks will filter any stacks excluded by the given opts.
+// filterStacks modifies the passed in stacks slice.
+func filterStacks(stacks []stack.Stack, skipID int, opts *opts) []stack.Stack {
+ filtered := stacks[:0]
+ for _, stack := range stacks {
+ // Always skip the running goroutine.
+ if stack.ID() == skipID {
+ continue
+ }
+ // Run any default or user-specified filters.
+ if opts.filter(stack) {
+ continue
+ }
+ filtered = append(filtered, stack)
+ }
+ return filtered
+}
+
+// Find looks for extra goroutines, and returns a descriptive error if
+// any are found.
+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++ {
+ stacks = filterStacks(stack.All(), cur, opts)
+
+ if len(stacks) == 0 {
+ return nil
+ }
+ retry = opts.retry(i)
+ }
+
+ 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)
+func VerifyNone(t TestingT, options ...Option) {
+ 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)
+ }
+}
diff --git a/vendor/go.uber.org/goleak/options.go b/vendor/go.uber.org/goleak/options.go
new file mode 100644
index 0000000000..d2d473b71e
--- /dev/null
+++ b/vendor/go.uber.org/goleak/options.go
@@ -0,0 +1,178 @@
+// Copyright (c) 2017 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package goleak
+
+import (
+ "strings"
+ "time"
+
+ "go.uber.org/goleak/internal/stack"
+)
+
+// Option lets users specify custom verifications.
+type Option interface {
+ apply(*opts)
+}
+
+// We retry up to 20 times if we can't find the goroutine that
+// we are looking for. In between each attempt, we will sleep for
+// a short while to let any running goroutines complete.
+const _defaultRetries = 20
+
+type opts struct {
+ filters []func(stack.Stack) bool
+ maxRetries int
+ maxSleep time.Duration
+ cleanup func(int)
+}
+
+// implement apply so that opts struct itself can be used as
+// an Option.
+func (o *opts) apply(opts *opts) {
+ opts.filters = o.filters
+ opts.maxRetries = o.maxRetries
+ opts.maxSleep = o.maxSleep
+ opts.cleanup = o.cleanup
+}
+
+// optionFunc lets us easily write options without a custom type.
+type optionFunc func(*opts)
+
+func (f optionFunc) apply(opts *opts) { f(opts) }
+
+// IgnoreTopFunction ignores any goroutines where the specified function
+// is at the top of the stack. The function name should be fully qualified,
+// e.g., go.uber.org/goleak.IgnoreTopFunction
+func IgnoreTopFunction(f string) Option {
+ return addFilter(func(s stack.Stack) bool {
+ return s.FirstFunction() == f
+ })
+}
+
+// Cleanup sets up a cleanup function that will be executed at the
+// end of the leak check.
+// When passed to [VerifyTestMain], the exit code passed to cleanupFunc
+// will be set to the exit code of TestMain.
+// When passed to [VerifyNone], the exit code will be set to 0.
+// This cannot be passed to [Find].
+func Cleanup(cleanupFunc func(exitCode int)) Option {
+ return optionFunc(func(opts *opts) {
+ opts.cleanup = cleanupFunc
+ })
+}
+
+// IgnoreCurrent records all current goroutines when the option is created, and ignores
+// them in any future Find/Verify calls.
+func IgnoreCurrent() Option {
+ excludeIDSet := map[int]bool{}
+ for _, s := range stack.All() {
+ excludeIDSet[s.ID()] = true
+ }
+ return addFilter(func(s stack.Stack) bool {
+ return excludeIDSet[s.ID()]
+ })
+}
+
+func maxSleep(d time.Duration) Option {
+ return optionFunc(func(opts *opts) {
+ opts.maxSleep = d
+ })
+}
+
+func addFilter(f func(stack.Stack) bool) Option {
+ return optionFunc(func(opts *opts) {
+ opts.filters = append(opts.filters, f)
+ })
+}
+
+func buildOpts(options ...Option) *opts {
+ opts := &opts{
+ maxRetries: _defaultRetries,
+ maxSleep: 100 * time.Millisecond,
+ }
+ opts.filters = append(opts.filters,
+ isTestStack,
+ isSyscallStack,
+ isStdLibStack,
+ isTraceStack,
+ )
+ for _, option := range options {
+ option.apply(opts)
+ }
+ return opts
+}
+
+func (o *opts) filter(s stack.Stack) bool {
+ for _, filter := range o.filters {
+ if filter(s) {
+ return true
+ }
+ }
+ return false
+}
+
+func (o *opts) retry(i int) bool {
+ if i >= o.maxRetries {
+ return false
+ }
+
+ d := time.Duration(int(time.Microsecond) << uint(i))
+ if d > o.maxSleep {
+ d = o.maxSleep
+ }
+ time.Sleep(d)
+ return true
+}
+
+// isTestStack is a default filter installed to automatically skip goroutines
+// that the testing package runs while the user's tests are running.
+func isTestStack(s stack.Stack) bool {
+ // Until go1.7, the main goroutine ran RunTests, which started
+ // the test in a separate goroutine and waited for that test goroutine
+ // to end by waiting on a channel.
+ // Since go1.7, a separate goroutine is started to wait for signals.
+ // T.Parallel is for parallel tests, which are blocked until all serial
+ // tests have run with T.Parallel at the top of the stack.
+ switch s.FirstFunction() {
+ case "testing.RunTests", "testing.(*T).Run", "testing.(*T).Parallel":
+ // In pre1.7 and post-1.7, background goroutines started by the testing
+ // package are blocked waiting on a channel.
+ return strings.HasPrefix(s.State(), "chan receive")
+ }
+ return false
+}
+
+func isSyscallStack(s stack.Stack) bool {
+ // Typically runs in the background when code uses CGo:
+ // https://github.com/golang/go/issues/16714
+ return s.FirstFunction() == "runtime.goexit" && strings.HasPrefix(s.State(), "syscall")
+}
+
+func isStdLibStack(s stack.Stack) bool {
+ // Importing os/signal starts a background goroutine.
+ // The name of the function at the top has changed between versions.
+ if f := s.FirstFunction(); f == "os/signal.signal_recv" || f == "os/signal.loop" {
+ return true
+ }
+
+ // Using signal.Notify will start a runtime goroutine.
+ return strings.Contains(s.Full(), "runtime.ensureSigM")
+}
diff --git a/vendor/go.uber.org/goleak/testmain.go b/vendor/go.uber.org/goleak/testmain.go
new file mode 100644
index 0000000000..7b1a50b7af
--- /dev/null
+++ b/vendor/go.uber.org/goleak/testmain.go
@@ -0,0 +1,69 @@
+// Copyright (c) 2017 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package goleak
+
+import (
+ "fmt"
+ "io"
+ "os"
+)
+
+// Variables for stubbing in unit tests.
+var (
+ _osExit = os.Exit
+ _osStderr io.Writer = os.Stderr
+)
+
+// TestingM is the minimal subset of testing.M that we use.
+type TestingM interface {
+ Run() int
+}
+
+// VerifyTestMain can be used in a TestMain function for package tests to
+// verify that there were no goroutine leaks.
+// To use it, your TestMain function should look like:
+//
+// func TestMain(m *testing.M) {
+// goleak.VerifyTestMain(m)
+// }
+//
+// See https://golang.org/pkg/testing/#hdr-Main for more details.
+//
+// This will run all tests as per normal, and if they were successful, look
+// for any goroutine leaks and fail the tests if any leaks were found.
+func VerifyTestMain(m TestingM, options ...Option) {
+ exitCode := m.Run()
+ opts := buildOpts(options...)
+
+ var cleanup func(int)
+ cleanup, opts.cleanup = opts.cleanup, nil
+ if cleanup == nil {
+ cleanup = _osExit
+ }
+ defer func() { cleanup(exitCode) }()
+
+ if exitCode == 0 {
+ if err := Find(opts); err != nil {
+ fmt.Fprintf(_osStderr, "goleak: Errors on successful test run: %v\n", err)
+ exitCode = 1
+ }
+ }
+}
diff --git a/vendor/go.uber.org/goleak/tracestack_new.go b/vendor/go.uber.org/goleak/tracestack_new.go
new file mode 100644
index 0000000000..d12ffd8404
--- /dev/null
+++ b/vendor/go.uber.org/goleak/tracestack_new.go
@@ -0,0 +1,34 @@
+// Copyright (c) 2021 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+//go:build go1.16
+// +build go1.16
+
+package goleak
+
+import (
+ "strings"
+
+ "go.uber.org/goleak/internal/stack"
+)
+
+func isTraceStack(s stack.Stack) bool {
+ return strings.Contains(s.Full(), "runtime.ReadTrace")
+}
diff --git a/vendor/go.uber.org/goleak/ya.make b/vendor/go.uber.org/goleak/ya.make
new file mode 100644
index 0000000000..400e32d0d7
--- /dev/null
+++ b/vendor/go.uber.org/goleak/ya.make
@@ -0,0 +1,27 @@
+GO_LIBRARY()
+
+LICENSE(MIT)
+
+SRCS(
+ doc.go
+ leaks.go
+ options.go
+ testmain.go
+ tracestack_new.go
+)
+
+GO_TEST_SRCS(
+ leaks_test.go
+ options_test.go
+ testmain_test.go
+ utils_test.go
+)
+
+GO_XTEST_SRCS(signal_test.go)
+
+END()
+
+RECURSE(
+ gotest
+ internal
+)