Closed nak3 closed 7 years ago
@nak3 Hello! Wanted to discuss how to handle this to potentially contribute.
func doTheStuff() int {
defer fmt.Println("!")
return 3
}
func main() {
os.Exit(doTheStuff())
}
http://stackoverflow.com/questions/27629380/how-to-exit-a-go-program-honoring-deferred-calls
Is this solution something y'all think is appropriate?
Sorry, that's not what I expected. I will send the patch later.
os.Exit(1)
doesn't return, sodefer close()
is not called. For example, nbdAction() have them.Please refer to https://gobyexample.com/exit