/
githubmirror
/
rclone
Обзор
Документация
Войти
/
githubmirror
/
rclone
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lib/caller/caller.go
26 строк
562 B
Nick Craig-Wood
pacer: factor call stack searching into its own package
12 ноя 2025, 15:22
12 ноя 2025, 15:22
b5e4d39
Код
Авторство
О чём код?
// Package caller contains functions to examine the call stack. package caller import ( "runtime" "strings" ) // Present looks for functionName in the call stack and return true if found // // Note that this ignores the caller. func Present(functionName string) bool { var pcs [48]uintptr n := runtime.Callers(3, pcs[:]) // skip runtime.Callers, Present and caller frames := runtime.CallersFrames(pcs[:n]) for { f, more := frames.Next() if strings.HasSuffix(f.Function, functionName) { return true } if !more { break } } return false }