-
Notifications
You must be signed in to change notification settings - Fork 110
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
updater.go: replace os.WriteFile with file.Write() #669
Conversation
replace os.WriteFile with file.Write() Signed-off-by: udf2457 <[email protected]>
This looks good, but I'm thinking about the |
I briefly considered it but ended up focusing my PR on the subject at hand and didn't touch anything surrounding it. I guess you can edit the commit ? |
File is closed on all branches in the code, removing this. Signed-off-by: Fredrik Skogman <[email protected]>
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.
Thank you!
@rdimitrov would you take an an extra look? |
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.
Looks good 🚀 I see we can also remove some of the err variables and put the statement in the if condition directly but that's just cosmetics and can be a separate PR.
Ref #667
I also added an explicit
file.Close()
on the error conditions here because otherwisedefer file.Close()
would be called after thefile.Remove()
, IIRC Windows errors if you attempt to remove an open file.