review feedback

pull/1614/head
Mike Auclair 2024-12-17 18:18:56 +00:00
parent 7f10816c93
commit cfee2346d7
1 changed files with 51 additions and 61 deletions

View File

@ -221,13 +221,14 @@ func CallerInfo() []string {
callers := []string{}
pcs := make([]uintptr, stackFrameBufferSize)
offset := 1
for {
n := runtime.Callers(offset, pcs)
if n == 0 {
return []string{}
break
}
maybeMore := n == stackFrameBufferSize
frames := runtime.CallersFrames(pcs[:n])
for {
@ -273,23 +274,12 @@ func CallerInfo() []string {
isTest(name, "Example") {
break
}
if more {
continue
if !more {
break
}
}
// We know we already have less than a buffer's worth of frames
if !maybeMore {
break
}
offset += stackFrameBufferSize
n = runtime.Callers(offset, pcs)
if n == 0 {
break
}
maybeMore = n == stackFrameBufferSize
frames = runtime.CallersFrames(pcs[:n])
}