This allows usage specific tests in big projects that recently started to use go-leak check.
Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com>
57 | 57 | }) |
|
58 | 58 | } |
|
59 | 59 | ||
60 | + | // IgnoreCurrent records all current goroutines when the option is created, and ignores |
|
61 | + | // them in any future Find/Verify calls. |
|
62 | + | func IgnoreCurrent() Option { |
|
63 | + | excludeIDSet := map[int]bool{} |
|
64 | + | for _, s := range stack.All() { |
|
65 | + | excludeIDSet[s.ID()] = true |
|
66 | + | } |
|
67 | + | return addFilter(func(s stack.Stack) bool { |
|
68 | + | return excludeIDSet[s.ID()] |
|
69 | + | }) |
|
70 | + | } |
|
71 | + | ||
60 | 72 | func maxSleep(d time.Duration) Option { |
|
61 | 73 | return optionFunc(func(opts *opts) { |
|
62 | 74 | opts.maxSleep = d |
Files | Coverage |
---|---|
internal/stack/stacks.go | 88.71% |
leaks.go | 100.00% |
options.go | 100.00% |
testmain.go | 100.00% |
Project Totals (4 files) | 95.42% |
TRAVIS_OS_NAME=linux 1.12.x=.12.x
1.14.x=.14.x TRAVIS_OS_NAME=linux
1.13.x=.13.x TRAVIS_OS_NAME=linux