aboutsummaryrefslogtreecommitdiffstats
path: root/modules/util/runtime.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/util/runtime.go')
-rw-r--r--modules/util/runtime.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/util/runtime.go b/modules/util/runtime.go
new file mode 100644
index 0000000000..91ec3c869c
--- /dev/null
+++ b/modules/util/runtime.go
@@ -0,0 +1,13 @@
+// Copyright 2024 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package util
+
+import "runtime"
+
+func CallerFuncName(skip int) string {
+ pc := make([]uintptr, 1)
+ runtime.Callers(skip+1, pc)
+ funcName := runtime.FuncForPC(pc[0]).Name()
+ return funcName
+}