同步等待 panic defer 

package main

import(
    "fmt"
)

func main(){
    // fmt.Println("Hello World")
    defer_all()
}

func defer_all(){
    defer func(){ fmt.Println("打印前") }()
    defer func(){ fmt.Println("打印中") }()
    defer func(){ fmt.Println("打印后") }()
    
    panic("触发异常")
}

 

相关文章:

  • 2021-08-01
  • 2021-12-27
  • 2022-02-17
  • 2022-12-23
  • 2021-10-09
  • 2021-06-17
  • 2022-01-27
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
相关资源
相似解决方案