From 6f4a41ca9368a0878f71b82cb5b0c7618f32cb56 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 8 Jan 2019 14:19:43 -0800 Subject: [PATCH] go-logging: provide right pc to runtime.FuncForPC We want a PC in the call instruction, not the PC of the instruction just after the call instruction. (A more robust fix would be to move to runtime.CallersFrames, as runtime.Callers+runtime.FuncForPC is deprecated.) This updates go-logging so it works with the mid-stack inlining coming with go 1.12. --- format.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format.go b/format.go index 7160674..b8f4227 100644 --- a/format.go +++ b/format.go @@ -385,7 +385,7 @@ func formatCallpath(calldepth int, depth int) string { if i < start { v += "." } - if f := runtime.FuncForPC(pc); f != nil { + if f := runtime.FuncForPC(pc - 1); f != nil { v += formatFuncName(fmtVerbShortfunc, f.Name()) } }