deferInit bugfix

This commit is contained in:
xushiwei
2024-06-03 01:32:25 +08:00
parent 56a5a7d72e
commit 2c799a8ccf
6 changed files with 63 additions and 95 deletions

View File

@@ -4,24 +4,15 @@ func f(s string) bool {
return len(s) > 2
}
func fail() {
panic("error")
}
func main() {
defer func() {
println("hi")
/*
if e := recover(); e != nil {
println(e.(string))
}
*/
}()
if s := "hello"; f(s) {
defer println(s)
} else {
defer println("world")
fail()
return
}
defer println("bye")
}