//error handle //when exit, print stack out func foo() { if err := recover(); err != nil { debug.PrintStack() log.Error("Error: ", err) }() }