Documentation ¶
Overview ¶
Package goleak is a Goroutine leak detector.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindLeaks ¶
FindLeaks looks for extra goroutines, and returns a descriptive error if any are found.
func VerifyNoLeaks ¶
VerifyNoLeaks calls FindLeaks and calls Error on the passed in TestingT if any leaks are found. This is a helper method to make it easier to integrate in tests by doing: defer VerifyNoLeaks(t)
func VerifyTestMain ¶
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) }
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.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option lets users specify custom verifications.
func IgnoreTopFunction ¶
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