如何使用内建函数recover终止panic过程

    1. func protect(g func()) {
    2. defer func() {
    3. log.Println("done")
    4. // Println executes normally even if there is a panic
    5. if x := recover(); x != nil {
    6. log.Printf("run time panic: %v", x)
    7. }
    8. }()
    9. log.Println("start")
    10. g()
    11. }