Add DefaultIgnoreFunctionSet#127
Conversation
This exposes a variable `DefaultIgnoreFunctionSet`, which can be used to set a default list of functions to ignore for goleak. Note that this mechanism is intended for library or tool authors who cannot directly call Ignore* Options to set up how their consumers are running the tests. They should be able to use linkname to set this variable to some well-known list of goroutines that leak if they really want to exempt their goroutines from getting continously flagged by goleak. Fixes uber-go#119.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #127 +/- ##
==========================================
+ Coverage 99.14% 99.17% +0.02%
==========================================
Files 5 5
Lines 234 242 +8
==========================================
+ Hits 232 240 +8
Misses 1 1
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I would still consider this useful, but since bazel-contrib/rules_go@0f1e0ae, rules_go doesn't need it anymore. Cc @linzhp |
Will that still be possible following golang/go#67401? |
| // by their consumers. | ||
| // Unless you are in such a situation, you should be using [IgnoreAnyFunction], | ||
| // [IgnoreCurrent], or [IgnoreTopFunction] instead. | ||
| var DefaultIgnoreFunctionSet string |
There was a problem hiding this comment.
Risk with making this an exported variable here is that libraries can't easily cooperate on setting this. It'll take one library to do goleak.DefaultIgnoreFunctionSet = "foo" to override other exceptions.
|
since rules_go no longer needs this, I think it's better to repurpose this feature specifically for library authors and expose a top-level function to append to ignorelist. Will work on that change and fix this PR |
This exposes a variable
DefaultIgnoreFunctionSet, which can be used to set a default list of functions to ignore for goleak.Note that this mechanism is intended for library or tool authors who cannot directly call Ignore* Options to set up how their consumers are running the tests. They should be able to use linkname to set this variable to some well-known list of goroutines that leak if they really want to exempt their goroutines from getting continously flagged by goleak.
Fixes #119.