Skip to content

Commit 2e04c16

Browse files
committed
chore: rename variables in firstExternalCaller() for clarity
1 parent 2ac39ee commit 2e04c16

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/st/cycle_detector.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
const (
1414
// maxStackDepthToCheck defines the maximum stack depth for runtime caller inspection.
15-
maxStackDepthToCheck = 32
15+
maxStackDepthToCheck = 64
1616
)
1717

1818
var (
@@ -21,18 +21,18 @@ var (
2121
)
2222

2323
func firstExternalCaller() *runtime.Frame {
24-
thisPC, _, _, ok := runtime.Caller(0)
24+
thisProgCtr, _, _, ok := runtime.Caller(0)
2525
if !ok {
2626
return nil
2727
}
28-
thisFunc := runtime.FuncForPC(thisPC)
28+
thisFunc := runtime.FuncForPC(thisProgCtr)
2929
pkgPrefix := getPackagePath(thisFunc)
3030

3131
// runtime.Callers (0), firstExternalCaller (1), the function calling firstExternalCaller (2)
3232
const skip = 2
33-
pc := make([]uintptr, maxStackDepthToCheck)
34-
n := runtime.Callers(skip, pc)
35-
frames := runtime.CallersFrames(pc[:n])
33+
progCtrsAboveUs := make([]uintptr, maxStackDepthToCheck)
34+
nProgCtrsAboveUs := runtime.Callers(skip, progCtrsAboveUs)
35+
frames := runtime.CallersFrames(progCtrsAboveUs[:nProgCtrsAboveUs])
3636

3737
for {
3838
frame, more := frames.Next()

0 commit comments

Comments
 (0)