goleak is a goroutine leak detector for Go that helps identify unexpected goroutines running after tests complete.
The tool addresses the problem of goroutine leaks, which occur when goroutines are inadvertently left running after test execution. goleak works by inspecting the set of running goroutines at the end of a test or test package and comparing it against a baseline to identify leaks. Developers can integrate it either by calling verification functions within individual tests or by using a TestMain function to check for leaks once after all tests in a package have finished running.
Teams should adopt goleak if they want automated detection of goroutine leaks during their test suite execution. It suits any Go project where goroutine management is important and leaks could accumulate over time. The tool is particularly valuable for long-running services where leaked goroutines might otherwise go unnoticed. One limitation to be aware of is that goleak cannot reliably distinguish between leaky goroutines and tests that have not yet finished when using t.Parallel, so the TestMain approach is recommended for parallel test suites.
The project maintains strict semantic versioning and has committed to no breaking changes to exported APIs before a major version bump. Development activity shows consistent attention to test coverage and build reliability, with active maintenance of compatibility across Go versions.