Created
May 12, 2020 14:50
-
-
Save Kubuxu/b2dfd1901d1a498798e4e3f06eddb0da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defer func() { | |
var fr [3]uintptr | |
runtime.Callers(1, fr[:]) | |
frames := runtime.CallersFrames(fr[:]) | |
if _, ok := frames.Next(); !ok { | |
return | |
} | |
frame, ok := frames.Next() | |
if !ok { | |
return | |
} | |
fmt.Printf("%s:%d\n", frame.File, frame.Line) | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment