This commit is contained in:
Mark McGranaghan
2012-09-23 12:59:46 -07:00
parent 618dec4fae
commit d7bb44ff42
14 changed files with 93 additions and 70 deletions

View File

@@ -1,21 +0,0 @@
// 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
func main() {
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
...
*/

13
025-panic/panic.go Normal file
View File

@@ -0,0 +1,13 @@
// ## 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
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.
panic("O noes")
}

7
025-panic/panic.sh Normal file
View File

@@ -0,0 +1,7 @@
$ go run 26-panic.go
panic: O noes
goroutine 1 [running]:
main.main()
/.../src/26-panic.go:4 +0x47
...