leakwait

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package leakwait is the goroutine leak check that the TestMain of a package runs once its tests ended.

A goroutine that a Close started is not always gone when Close returns (a client of a database ends its reader and writer goroutines in the background), so a single look at the goroutine dump right after the tests is a race. Wait looks again until nothing that matches is left, and fails only when the bound ends first.

Index

Constants

View Source
const Bound = 30 * time.Second

Bound is how long a goroutine that is winding down is given to end. It only matters when there is a leak.

Variables

This section is empty.

Functions

func Contains

func Contains(parts ...string) func(string) bool

Contains returns a matcher for the stacks that hold any of the strings.

func Matching

func Matching(match func(stack string) bool) []string

Matching returns the stacks of the goroutines that match now.

func Wait

func Wait(bound time.Duration, match func(stack string) bool) []string

Wait polls the goroutine dump until no goroutine matches, or until bound ends. It returns the stacks of the goroutines that still match (nil when none do). match gets the full stack of one goroutine.

Types

This section is empty.

Jump to

Keyboard shortcuts

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