Skip to content

Instantly share code, notes, and snippets.

@jochasinga
Created September 30, 2014 21:37
Show Gist options
  • Save jochasinga/978aaf52d853a41f37d8 to your computer and use it in GitHub Desktop.
Save jochasinga/978aaf52d853a41f37d8 to your computer and use it in GitHub Desktop.
Defer-panic-recover suite in Go
package main
import "fmt"
func main() {
// makes sure recover gets call when faced with panic
defer func() {
str := recover()
fmt.Println(str)
}()
// call for a panic attack!
panic("PANIC")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment