All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: andrey1s <andrey@4devs.pro> Reviewed-on: #5 Co-authored-by: andrey <andrey@4devs.io> Co-committed-by: andrey <andrey@4devs.io>
23 lines
315 B
Go
23 lines
315 B
Go
package entry
|
|
|
|
import (
|
|
"path/filepath"
|
|
"runtime"
|
|
"strconv"
|
|
)
|
|
|
|
func Caller(depth int, full bool) string {
|
|
const offset = 3
|
|
_, file, line, has := runtime.Caller(depth + offset)
|
|
|
|
if !has {
|
|
file, line = "???", 0
|
|
}
|
|
|
|
if !full && has {
|
|
file = filepath.Base(file)
|
|
}
|
|
|
|
return file + ":" + strconv.Itoa(line)
|
|
}
|