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.
Created
April 19, 2021 09:32
-
-
Save Integralist/cbf2814b2565b540fdf986d4975a007a 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