Go 系列教程 —— 32. panic 和 recover

Noluye · 2018-04-12 22:58:17

程序首先会打印出传入 panic 函数的信息: panic: runtime error: last name cannot be empty

panic("runtime error: first name cannot be nil") // 演示代码用的是 nil

#1
更多评论

我的go版本是go1.10.3 darwin/amd64,在这个例子中,我这边有时候打印 panic: runtime error: last name cannot be nil deferred call in fullName

deferred call in main

有时候打印 deferred call in fullName panic: runtime error: last name cannot be nil

deferred call in main

#2
jikeytang
大风起兮云飞扬,威加海内兮归故乡

清晰,明了。不错的教程,看一遍是一遍的收获。

#3