From 37e21909a5126cba7337466cb4b417794809be90 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Thu, 20 Sep 2012 19:52:18 -0700 Subject: [PATCH] doc panic --- src/26-panic.go | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/26-panic.go b/src/26-panic.go index de1aded..08510af 100644 --- a/src/26-panic.go +++ b/src/26-panic.go @@ -1,8 +1,21 @@ + // Panic + + // 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 -import "fmt" - func main() { - panic("O noes") - fmt.Println("Finished") -} + panic("O noes") // We'll use panic throught this book to check for +} // unexpected errors. This is the only program in the + // book designed to panic. + +/* +$ go run 26-panic.go +panic: O noes + +goroutine 1 [running]: +main.main() + /.../src/26-panic.go:4 +0x47 +... +*/