lean into examples

This commit is contained in:
Mark McGranaghan
2012-10-09 21:02:12 -07:00
parent 5d1775bdaa
commit 8daa226a48
130 changed files with 4 additions and 4 deletions

11
examples/panic/panic.go Normal file
View File

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

7
examples/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
...