goleak icon indicating copy to clipboard operation
goleak copied to clipboard

Add DefaultIgnoreFunctionSet

Open sywhang opened this issue 1 year ago • 4 comments

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.

sywhang avatar Jul 24 '24 16:07 sywhang

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 99.17%. Comparing base (898a938) to head (974cb98). :warning: Report is 3 commits behind head on master.

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              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 24 '24 16:07 codecov[bot]

I would still consider this useful, but since https://github.com/bazelbuild/rules_go/commit/0f1e0ae83d2a6f0746b9c083880b5c2239e3256f, rules_go doesn't need it anymore. Cc @linzhp

fmeum avatar Jul 24 '24 16:07 fmeum

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.

Will that still be possible following https://github.com/golang/go/issues/67401?

abhinav avatar Jul 24 '24 16:07 abhinav

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

sywhang avatar Jul 24 '24 17:07 sywhang