linter proposal: detect using of a context known to be expired in a deferred cleanup action #5558
Unanswered
starius
asked this question in
Linter Ideas
Replies: 1 comment
-
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Welcome
How did you install golangci-lint?
I don't know
Your feature request related to a problem? Please describe
I have the following code:
In this function at least some return paths happen because the ctx expires. In this case function
releaseResource
would fail to release a resource, because ctx expired.Describe the solution you'd like
It makes sense to change the code as follows:
so an expired context wouldn't prevent the cleanup.
Describe alternatives you've considered
I don't know any alternatives.
Additional context
No response
Supporter
Beta Was this translation helpful? Give feedback.
All reactions