From 58b809110d77310687e5af1578dace564207d187 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Fri, 12 Oct 2012 05:33:43 -0700 Subject: [PATCH] panic and defer notes --- examples/defer/defer.go | 2 ++ examples/panic/panic.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/defer/defer.go b/examples/defer/defer.go index d8fa3b8..037bb53 100644 --- a/examples/defer/defer.go +++ b/examples/defer/defer.go @@ -14,3 +14,5 @@ func main() { defer second() first() } + +// todo: review http://blog.golang.org/2010/08/defer-panic-and-recover.html diff --git a/examples/panic/panic.go b/examples/panic/panic.go index 82b79f3..e39ae61 100644 --- a/examples/panic/panic.go +++ b/examples/panic/panic.go @@ -1,9 +1,11 @@ // A `panic` means something went unexpectedly wrong. // Mostly we use it to fail fast on errors that // shouldn't occur during normal operation. + package main func main() { + // We'll use panic throught this book to check for // unexpected errors. This is the only program in the // book designed to panic.