# 18.10 其他 如何在程序出错时停止: ```go if err != nil { fmt.Printf(“Program stopping with error %v”, err) os.Exit(1) } ``` 或者: ```go if err != nil { panic(“ERROR occurred: “ + err.Error()) } ``` ## 链接 - [目录](directory.md) - 上一章:[运算符模板和接口](17.4.md) - 下一节:[字符串](18.1.md)