panic
signals "the programmer has made a fundamental mistake and execution cannot continue safely", whereas os.Exit
signals "the programmer has decided that the process should terminate here" — different meanings. Also, important difference in behavior: panic
will unwind the callstack, which means it will call any pending defer
statements; os.Exit
will just do a hard kill, so it won't.
-
-
Save boseabhishek/3af06218b44577674cae0a76e171850a to your computer and use it in GitHub Desktop.
[Golang: panic vs os.Exit] #go #golang #panic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment