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)
Option lets users specify custom verifications.
( Option) apply(*opts)
optionFunc
*opts
func Cleanup(cleanupFunc func(exitCode int)) Option
func IgnoreCurrent() Option
func IgnoreTopFunction(f string) Option
func addFilter(f func(stack.Stack) bool) Option
func maxSleep(d time.Duration) Option
func Find(options ...Option) error
func VerifyNone(t TestingT, options ...Option)
func VerifyTestMain(m TestingM, options ...Option)
func buildOpts(options ...Option) *opts
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/internal/grpclog.LoggerV2 (interface)
*testing.B
*testing.F
*testing.T
testing.TB (interface)
*google.golang.org/grpc/grpclog.componentData
*google.golang.org/grpc/grpclog.loggerT
*google.golang.org/grpc/grpclog.loggerWrapper
*testing.common
func VerifyNone(t TestingT, options ...Option)
Package-Level Functions (total 14, in which 6 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.
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)
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)
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)