Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: control panic behaviour programmatically #21777
What version of Go are you using (
changed the title from
Control panic behaviour programmatically
runtime: control panic behaviour programmatically
Sep 6, 2017
Note that in the general case we can not run user code on program error. You cite #21376, but as far as I can see the example there is not a panic, it's an exception. An exception can not in general be recovered, so it's not clear that it matters that it was run on a library goroutine. That is, even if we provided a way to recover a panic on any arbitrary goroutine, for an exception that recover would never be run anyhow. So fixing that will not fix your real problem.
I think the only general way you can do what you want is to use a small wrapper program that starts your real program and handles the stack trace.
I'll leave this open for now but I suspect we're going to close this without taking any action, since any fix we make will be only partial.