• During panic, normal execution stop, defered function in goroutine executed and the program crash with log message
  • Ex. Declare a panic. 
  • A panic causes program to crash. We should handle unexpected situation gracefully by error values.
  • Ex. when panic happen, deferred methods will be called in reversed order until main method
  • Use recover to prevent program crash by a panic
  • Ex. Print stack trace in defer


Tags:

Updated: