Files
the-way-to-go_ZH_CN/eBook/18.10.md
2018-06-03 15:54:18 +08:00

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())
}

链接