-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Refactor: fixing (potential) bugs around closing #1995
Conversation
I have been meaning to do this for a while now. Thank you very much for getting this sorted 👍 |
I was merely following some linter issues. |
I know. That’s exactly what I have been intending to do for quite some time 🙂 |
@Jacalz from your comments I assumed you would be best placed to review this. |
Please go ahead. I have a lot to do at the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of good catches here, thanks.
However many of the "defer returned" errors are not returned as their values are shadowed by local variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about named returns and simplification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the last commit, I think that change should be applied to the remaining defer functions too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
And thanks for educating us on some of the defer and return code.
Glad to hear they are considering removing naked returns :)
Description:
There was one http body close missing.
The other fixes resolve around ignoring the error on writable file handler closing (which should not be done). An error might be returned from
Close
that indicates a write failure. For more details see https://www.joeshaw.org/dont-defer-close-on-writable-files/Checklist: