Add linting rule for preferring defer
over t.Cleanup
in tests (except helpers)
#3181
Labels
stale
This issue is like stale bread.
The premise is that we want tests to use
defer
so that they read like idiomatic Go code and that there is no mixed usage ofdefer
andt.Cleanup
(since the order of execution is hard to reason about, and rarely the intent). The exception is test helper functions.This was requested in #3113 but not required for merging the PR.
A few examples for ruleguard rules was floated in #3113 but both have unnecessary repercussions:
t.Cleanup
is insideif {}
it won't be caughtThe text was updated successfully, but these errors were encountered: