testleak

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package testleak centralises goroutine-leak detection for tests. It wraps goleak.VerifyTestMain with a shared ignore list for the long-lived goroutines gopherstack legitimately runs (metrics collectors, persistence timers, runtime/test-framework internals) so individual packages can opt in with a one-line TestMain:

func TestMain(m *testing.M) { testleak.VerifyTestMain(m) }

Packages that spawn their own known-persistent goroutines can pass extra goleak.Option values (e.g. goleak.IgnoreTopFunction("...")).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyTestMain

func VerifyTestMain(m *testing.M, extra ...goleak.Option)

VerifyTestMain runs the package's tests via m and then asserts that no unexpected goroutines were leaked, exiting non-zero if any are found. Pass extra options to ignore package-specific long-lived goroutines.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL