Answer the question
In order to leave comments, you need to log in
What is the difference between Exit, Panic, Fatal, Recover, what do they do and when is it better to use them?
Help me figure it out, everything is clear with Exit, it completes the program, I understand that I don’t write anything to the log.
How do Panic, Fatal and Recover work?
For example, if I call Panic, Fatal or Recover does it terminate the program and write an error to the log or what?
Answer the question
In order to leave comments, you need to log in
In short, log.Fatal is the same Exit, only with a message written to the log.
panic is something like a very serious exception that can usually be caught inside a defer. But there are some types of panics that are impossible to catch because they are related to memory corruption, for example. Such panics, as well as those that we did not catch, will write a stacktrace and terminate the program.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question