http://golang.org/pkg/runtime/debug/#Stack
Well, no, that will only display the stack from the point you call debug.Stack(), which will be my recover. I know where my recover is, I want to know where the panic was.
> It does show that. Did you try to run the code in my previous post?
I think the code got lost along the way: the link http://goo.gl/Oh57Y
just gets you to a default instance of the Go playground.
Chris
--
Chris "allusive" Dollin
On 10 August 2011 17:47, Jan Mercl <jan....@nic.cz> wrote:I think the code got lost along the way: the link http://goo.gl/Oh57Y
> It does show that. Did you try to run the code in my previous post?
just gets you to a default instance of the Go playground.
2009/11/10 23:00:00 oops: /tmpfs/gosandbox-b09dc5b6_0fad6379_d8e30e8a_ae284a8e_aa48d082/prog.go:20 (0x400da1) /tmp/sandbox/go/src/pkg/runtime/proc.c:1041 (0x40dded) /tmpfs/gosandbox-b09dc5b6_0fad6379_d8e30e8a_ae284a8e_aa48d082/prog.go:10 (0x400c50) /tmpfs/gosandbox-b09dc5b6_0fad6379_d8e30e8a_ae284a8e_aa48d082/prog.go:14 (0x400c6d) /tmpfs/gosandbox-b09dc5b6_0fad6379_d8e30e8a_ae284a8e_aa48d082/prog.go:24 (0x400cb7) /tmp/sandbox/go/src/pkg/runtime/amd64/asm.s:77 (0x401b01) /tmp/sandbox/go/src/pkg/runtime/proc.c:178 (0x40c7c5)
Stack returns a formatted stack trace of the goroutine that calls it. For each routine, it includes the source line information and PC value, then attempts to discover, for Go functions, the calling function or method and the text of the line containing the invocation.
That's very odd. When I click the link, I get a page with the right URL,
with the #package main and everything, but it /displays/ the initial
hello-world code, and won't do otherwise.
There's probably some arcane browser config thing going on.
Well, well. Works on my phone, not on my desktop FireFox. Thanks for the tip, Jan.
The semantics of panic are that the deferred handlers appear
to have been called from the site of the panic, exactly so that
the stack trace is preserved. This is an intentional feature.
Russ