Skip to content

Return the err from f.Close()#249

Merged
mattlandis merged 1 commit intoaws:masterfrom
mogren:fix-defer-close
Jan 8, 2019
Merged

Return the err from f.Close()#249
mattlandis merged 1 commit intoaws:masterfrom
mogren:fix-defer-close

Conversation

@mogren
Copy link
Copy Markdown
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/
@mogren mogren requested a review from vsiddharth December 15, 2018 03:06
Copy link
Copy Markdown
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