Skip to content
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

Return the err from f.Close() #249

Merged
merged 1 commit into from
Jan 8, 2019
Merged

Conversation

mogren
Copy link
Contributor

@mogren mogren commented Nov 29, 2018

In the case of an EIO (IO Exception) the error from the write would be lost because of the use of defer.

See https://www.joeshaw.org/dont-defer-close-on-writable-files/

Description of changes:
Return the return value of f.Close() for a successful f.WriteString in case of an EIO.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

In the case of an EIO (IO Exception) the error from the write would be
lost because of the use of defer.

See https://www.joeshaw.org/dont-defer-close-on-writable-files/
Copy link
Contributor

@mattlandis mattlandis left a comment

Choose a reason for hiding this comment

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

/lgtm

@mattlandis mattlandis merged commit 9365868 into aws:master Jan 8, 2019
@mogren mogren added this to the v1.4 milestone Mar 5, 2019
@mogren mogren deleted the fix-defer-close branch March 20, 2019 21:42
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.

2 participants