debug.Stack() should not be passed to d.Panic(), as this could be a performance bottleneck. If necessary, it can be called in the d.Panic() call itself with the same result.
Instead, pass the returned value r of the recovery, to propagate the reason for the panic.
Similarly, if no panic handling is defined, print the r value to allow for better debug messages.
What
debug.Stack()
should not be passed tod.Panic()
, as this could be a performance bottleneck. If necessary, it can be called in thed.Panic()
call itself with the same result. Instead, pass the returned valuer
of the recovery, to propagate the reason for the panic.Similarly, if no panic handling is defined, print the
r
value to allow for better debug messages.Suggested here: https://t.me/GotgbotChat/6370
Impact