Merge remote-tracking branch 'macilias/master'

This commit is contained in:
Mark McGranaghan
2019-06-30 14:06:23 -07:00
3 changed files with 28 additions and 7 deletions

View File

@@ -40,5 +40,10 @@ func writeFile(f *os.File) {
func closeFile(f *os.File) {
fmt.Println("closing")
f.Close()
err := f.Close()
// It is important to check for errors when closing a file, even in a deferred function.
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
}
}

View File

@@ -1,2 +1,2 @@
570699fc50a1d39e9d0ad6a4461aef3248b080e1
xPbQ5SGkH2O
4e2229c593e102d4efd101a7e9aa21f3345e90d1
S2RuPTkABip