You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately os.Exit simply exits the program where it is called. So it stops every kind of reasonable teardown. So think about only using it on the main of your program to make sure everything shuts down correctly.
Funnily enough, most of my golang programs ends with a structure like this
package main
import (
"os"
)
funcmainWithError() error {
// Here should be program...returnnil
}
funcmain() {
err:=mainWithError()
iferr!=nil {
os.Exit(1)
}
}
The text was updated successfully, but these errors were encountered:
Unfortunately
os.Exit
simply exits the program where it is called. So it stops every kind of reasonable teardown. So think about only using it on the main of your program to make sure everything shuts down correctly.Funnily enough, most of my golang programs ends with a structure like this
The text was updated successfully, but these errors were encountered: