This question already has an answer here:
I have a problem how to modify return value with panic and recover in golang please help me, thank you!
func foo1() int {
defer func() {
if p := recover(); p != nil {
fmt.Printf("internal error: %v
", p)
}
// how can I do?
}()
panic("test error")
return 10
}
</div>