Skip to content

Instantly share code, notes, and snippets.

@bjorand
Created April 9, 2017 09:56
Show Gist options
  • Save bjorand/91caee7ff5f1a3a58419f35bda48cf02 to your computer and use it in GitHub Desktop.
Save bjorand/91caee7ff5f1a3a58419f35bda48cf02 to your computer and use it in GitHub Desktop.
Golang catch panic
for {
func() {
defer func() {
if r := recover(); r != nil {
fmt.Printf("panic: %v\n", r)
}
}()
// CODE here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment