Go - Functions - 6 (panic, recover, stackTrace)


  • 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


沒有留言:

張貼留言

Lessons Learned While Benchmarking vLLM with GPU

Recently, I benchmarked vLLM on a GPU to better understand how much throughput can realistically be expected in an LLM serving setup. One ...