CDR request 2

This commit is contained in:
Maciek Niemczyk 2019-06-17 14:47:46 +02:00
parent 862833fcb8
commit b00cb1ec7e

View File

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