recover()
What will be printed when the code below is executed?What will be the exit code after the code below is executed?
package main
import "log"
func f() {
defer func() {
if r := recover(); r != nil {
log.Printf("recover:%#v", r)
}
}()
panic(1)
panic(2)
}
func main() {
f()
}
Answer
2009/11/10 23:00:00 recover:1