Skip to content

Instantly share code, notes, and snippets.

@Kubuxu
Created May 12, 2020 14:50
Show Gist options
  • Save Kubuxu/b2dfd1901d1a498798e4e3f06eddb0da to your computer and use it in GitHub Desktop.
Save Kubuxu/b2dfd1901d1a498798e4e3f06eddb0da to your computer and use it in GitHub Desktop.
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