Skip to content

18.10 其他

84字小于1分钟

2024-12-11

如何在程序出错时终止程序:

if err != nil {
   fmt.Printf("Program stopping with error %v", err)
   os.Exit(1)
}

或者:

if err != nil {
	panic("ERROR occurred: " + err.Error())
}

链接

Copyright © 2024 Anysome