runtime error: index out of range [1] with length 0 C:/Users/zhonghuihong/go/src/playground/stack.go:15 Try.func1 C:/Go/src/runtime/panic.go:1038 gopanic C:/Go/src/runtime/panic.go:90 goPanicIndex C:/Users/zhonghuihong/go/src/playground/stack.go:28 testTryGet C:/Users/zhonghuihong/go/src/playground/stack.go:20 Try C:/Users/zhonghuihong/go/src/playground/stack.go:36 main C:/Go/src/runtime/proc.go:255 main C:/Go/src/runtime/asm_amd64.s:1581 goexit
// If pc represents multiple functions because of inlining, it returns // the *Func describing the innermost function, but with an entry of // the outermost function.
runtime error: index out of range [1] with length 0 C:/Users/zhonghuihong/go/src/playground/stack.go:15 Try.func1 C:/Go/src/runtime/panic.go:1038 gopanic C:/Go/src/runtime/panic.go:90 goPanicIndex C:/Users/zhonghuihong/go/src/playground/stack.go:38 main.func1 C:/Users/zhonghuihong/go/src/playground/stack.go:20 Try C:/Users/zhonghuihong/go/src/playground/stack.go:36 main C:/Go/src/runtime/proc.go:255 main C:/Go/src/runtime/asm_amd64.s:1581 goexit
// To translate these PCs into symbolic information such as function // names and line numbers, use CallersFrames. CallersFrames accounts // for inlined functions and adjusts the return program counters into // call program counters. Iterating over the returned slice of PCs // directly is discouraged, as is using FuncForPC on any of the // returned PCs, since these cannot account for inlining or return // program counter adjustment.