diff options
Diffstat (limited to 'pkg/utils')
-rw-r--r-- | pkg/utils/utils.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 3f882c2b5..2f33862e8 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -128,3 +128,10 @@ func StackTrace() string { n := runtime.Stack(buf, false) return fmt.Sprintf("%s\n", buf[:n]) } + +// returns the path of the file that calls the function. +// 'skip' is the number of stack frames to skip. +func FilePath(skip int) string { + _, path, _, _ := runtime.Caller(skip) + return path +} |