MCPcopy
hub / github.com/uber-go/goleak / VerifyNone

Function VerifyNone

leaks.go:91–108  ·  view source on GitHub ↗

VerifyNone marks the given TestingT as failed if any extra goroutines are found by Find. This is a helper method to make it easier to integrate in tests by doing: defer VerifyNone(t) VerifyNone is currently incompatible with t.Parallel because it cannot associate specific goroutines with specific

(t TestingT, options ...Option)

Source from the content-addressed store, hash-verified

89// If you need to run tests in parallel, use [VerifyTestMain] instead,
90// which will verify that no leaking goroutines exist after ALL tests finish.
91func VerifyNone(t TestingT, options ...Option) {
92 opts := buildOpts(options...)
93 var cleanup func(int)
94 cleanup, opts.cleanup = opts.cleanup, nil
95
96 if h, ok := t.(testHelper); ok {
97 // Mark this function as a test helper, if available.
98 h.Helper()
99 }
100
101 if err := Find(opts); err != nil {
102 t.Error(err)
103 }
104
105 if cleanup != nil {
106 cleanup(0)
107 }
108}

Callers 3

TestVerifyNoneFunction · 0.85
TestIgnoreCurrentFunction · 0.85
TestVerifyParallelFunction · 0.85

Calls 4

buildOptsFunction · 0.85
FindFunction · 0.85
HelperMethod · 0.80
ErrorMethod · 0.65

Tested by 3

TestVerifyNoneFunction · 0.68
TestIgnoreCurrentFunction · 0.68
TestVerifyParallelFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…