RosettaCodeData/Task/Program-termination/Go/program-termination-3.go

14 lines
251 B
Go
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
func main() {
fmt.Println("main program start")
// this will not get run on os.Exit
defer func() {
fmt.Println("deferred function")
}()
if problem {
fmt.Println("main program exiting")
os.Exit(-1)
}
}