package goleak

Import Path
	go.uber.org/goleak (on go.dev)

Dependency Relation
	imports 7 packages, and imported by 0 packages

Involved Source Files Package goleak is a Goroutine leak detector. leaks.go options.go testmain.go tracestack_new.go
Package-Level Type Names (total 6, in which 3 are exported)
/* sort exporteds by: | */
Option lets users specify custom verifications. func Cleanup(cleanupFunc func(exitCode int)) Option func IgnoreAnyFunction(f string) Option func IgnoreCurrent() Option func IgnoreTopFunction(f string) Option func Find(options ...Option) error func VerifyNone(t TestingT, options ...Option) func VerifyTestMain(m TestingM, options ...Option)
TestingM is the minimal subset of testing.M that we use. ( TestingM) Run() int *testing.M func VerifyTestMain(m TestingM, options ...Option)
TestingT is the minimal subset of testing.TB that we use. ( TestingT) Error(...interface{}) *go.uber.org/zap.SugaredLogger google.golang.org/grpc/grpclog.DepthLoggerV2 (interface) google.golang.org/grpc/grpclog.LoggerV2 (interface) google.golang.org/grpc/grpclog/internal.DepthLoggerV2 (interface) google.golang.org/grpc/grpclog/internal.LoggerV2 (interface) *google.golang.org/grpc/grpclog/internal.LoggerWrapper *testing.B *testing.F *testing.T testing.TB (interface) func VerifyNone(t TestingT, options ...Option)
Package-Level Functions (total 15, in which 7 are exported)
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].
Find looks for extra goroutines, and returns a descriptive error if any are found.
IgnoreAnyFunction ignores goroutines where the specified function is present anywhere in the stack. The function name must be fully qualified, e.g., go.uber.org/goleak.IgnoreAnyFunction For methods, the fully qualified form looks like: go.uber.org/goleak.(*MyType).MyMethod
IgnoreCurrent records all current goroutines when the option is created, and ignores them in any future Find/Verify calls.
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
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) VerifyNone is currently incompatible with t.Parallel because it cannot associate specific goroutines with specific tests. Thus, non-leaking goroutines from other tests running in parallel could fail this check. If you need to run tests in parallel, use [VerifyTestMain] instead, which will verify that no leaking goroutines exist after ALL tests finish.
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.
Package-Level Variables (total 2, neither is exported)
Package-Level Constants (only one, which is unexported)