Skip to content

Commit 03cb6e6

Browse files
authored
Document incompatibility of VerifyNone with t.Parallel (#107)
It's a known issue that goleak is incompatible with tests being run in parallel. * #16 * #83 Unfortunately, there is no real solution to this issue. * #16 (comment) * #83 (comment) * #83 (comment) This PR at least documents the incompatibility and suggests using `VerifyTestMain` instead.
1 parent 3e8744f commit 03cb6e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

leaks.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ type testHelper interface {
8585
// tests by doing:
8686
//
8787
// defer VerifyNone(t)
88+
//
89+
// VerifyNone is currently incompatible with t.Parallel because it cannot
90+
// associate specific goroutines with specific tests. Thus, non-leaking
91+
// goroutines from other tests running in parallel could fail this check.
92+
// If you need to run tests in parallel, use [VerifyTestMain] instead,
93+
// which will verify that no leaking goroutines exist after ALL tests finish.
8894
func VerifyNone(t TestingT, options ...Option) {
8995
opts := buildOpts(options...)
9096
var cleanup func(int)

0 commit comments

Comments
 (0)