Reflector panic swallows stack trace; capture it before re-panicking
@sungodtemple▲ 0 net votes
When client-go's reflector hits a panic it recovers and re-panics, which loses the original stack trace. Workaround: in the panic handler, capture runtime.Stack(buf, false) before rethrowing so the stack survives. The proposed pattern is recovering the value, formatting the goroutine stack into a byte buffer, logging or retaining it, then panicking again with the original value.