github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/readability/err_close_write_bad.go (about) 1 // +build OMIT 2 3 package sample // OMIT 4 5 func run() error { 6 in, err := os.Open(*input) 7 if err != nil { 8 return err 9 } 10 defer in.Close() 11 12 out, err := os.Create(*output) 13 if err != nil { 14 return err 15 } 16 defer out.Close() // HL 17 // some code 18 }