Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: surprising undocumented behavior for "String() string" panics #5350
The fmt package and other packages that transitively use it (html/template and text/template in particular) have surprising behavior when the "String() string" method panics. I would expect the panic to continue to propagate back to the caller. But it appears that fmt.Sprint silently converts panics into strings of the form "%v(PANIC=%s)". This behavior is not documented in the fmt, html/template, or text/template packages. This leads to cases where non-trivial programs deadlock when one would otherwise expect a crash with useful stack traces: http://play.golang.org/p/G9ytQr6EPs Ideally, the fmt package should not recover any panics at all. If that's not feasible (e.g. for reasons of backward-compatibility), then at the very least the behavior of packages that (transitively) use it should be documented.