aboutsummaryrefslogtreecommitdiffstats
path: root/modules/util/runtime.go
blob: 91ec3c869c35fdae23a308503add421722f83434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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
}