Skip to content

Improving return with defers blocking #1349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 17, 2024

Conversation

grantnelson-wf
Copy link
Collaborator

@grantnelson-wf grantnelson-wf commented Nov 1, 2024

Currently, if there are any defers and any returns in a function, that return is considered blocking because the defer may be blocking.

I changed the analysis to keep a running list of defers and assign return statements with the defers that may affect them. There are still some false positive cases (blocking when blocking isn't actually needed) however there should be a lot less false positives after this change.

I also fixed a formatting issue that somehow was missed by a linter.

@grantnelson-wf grantnelson-wf force-pushed the blockingDeferReturns branch 3 times, most recently from 9a20529 to 1d78df5 Compare November 1, 2024 18:03
@grantnelson-wf grantnelson-wf force-pushed the blockingDeferReturns branch 4 times, most recently from e3ba1aa to ec7099e Compare November 11, 2024 20:18
@grantnelson-wf grantnelson-wf self-assigned this Nov 11, 2024
@grantnelson-wf grantnelson-wf changed the title [WIP] Improving return with defers blocking Improving return with defers blocking Nov 11, 2024
@grantnelson-wf grantnelson-wf marked this pull request as ready for review November 11, 2024 20:35
Copy link
Member

@flimzy flimzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything that jumps out at me, but it's hard to validate this sort of code visually. I'm happy with merging it, but maybe @nevkontakte wants to take a look too.

@grantnelson-wf grantnelson-wf marked this pull request as draft November 14, 2024 18:20
@grantnelson-wf grantnelson-wf marked this pull request as ready for review November 14, 2024 18:32
@nevkontakte
Copy link
Member

LGTM, thank you!

@nevkontakte nevkontakte merged commit 3c9b135 into gopherjs:master Nov 17, 2024
10 checks passed
@grantnelson-wf grantnelson-wf deleted the blockingDeferReturns branch November 18, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants