updater.go: replace os.WriteFile with file.Write()#669
updater.go: replace os.WriteFile with file.Write()#669kommendorkapten merged 2 commits intotheupdateframework:masterfrom
Conversation
replace os.WriteFile with file.Write() Signed-off-by: udf2457 <udf2457@users.noreply.github.com>
|
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 <kommendorkapten@github.com>
|
@rdimitrov would you take an an extra look? |
rdimitrov
left a comment
There was a problem hiding this comment.
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.