Skip to content

Commit

Permalink
Clean up the defer example a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Jan 29, 2025
1 parent 2a6ddb9 commit 9f92e06
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
4 changes: 1 addition & 3 deletions examples/defer/defer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func createFile(p string) *os.File {
func writeFile(f *os.File) {
fmt.Println("writing")
fmt.Fprintln(f, "data")

}

func closeFile(f *os.File) {
Expand All @@ -46,7 +45,6 @@ func closeFile(f *os.File) {
// It's 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)
panic(err)
}
}
4 changes: 2 additions & 2 deletions examples/defer/defer.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
f0eb978a0cdbacc5e4d709bccce6cea6b71be39f
5SDVfc_jxbg
249d0bc915e075a664be8b4e9115aa9568c8999e
nhAzhDn_jga
20 changes: 5 additions & 15 deletions public/defer

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9f92e06

Please sign in to comment.