mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 00:05:14 +08:00
410 B
410 B
18.10 其他
如何在程序出错时终止程序:
if err != nil {
fmt.Printf("Program stopping with error %v", err)
os.Exit(1)
}
或者:
if err != nil {
panic("ERROR occurred: " + err.Error())
}
链接
- 目录
- 上一节:网络和网页应用
- 下一节:出于性能考虑的最佳实践和建议