Files
gitea/modules/util/runtime.go
Lunny Xiao 69f5ee970c Move some functions to gitrepo package (#35543)
Refactor Git command functions to use WithXXX methods instead of
exposing RunOpts.
This change simplifies reuse across gitrepo and improves consistency,
encapsulation, and maintainability of command options.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-07 17:06:51 +08:00

18 lines
404 B
Go

// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package util
import "runtime"
func CallerFuncName(optSkipParent ...int) string {
pc := make([]uintptr, 1)
skipParent := 0
if len(optSkipParent) > 0 {
skipParent = optSkipParent[0]
}
runtime.Callers(skipParent+1 /*this*/ +1 /*runtime*/, pc)
funcName := runtime.FuncForPC(pc[0]).Name()
return funcName
}