From 143e758beca45f71748a42a70f8035ceedc6372e Mon Sep 17 00:00:00 2001 From: kkocdko <31189892+kkocdko@users.noreply.github.com> Date: Sun, 21 Apr 2024 04:22:09 +0800 Subject: [PATCH] tweak caller skip count --- utils/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 260287bc..b8d30b35 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -33,8 +33,8 @@ func sourceDir(file string) string { // FileWithLineNum return the file name and line number of the current file func FileWithLineNum() string { pcs := [13]uintptr{} - // the second caller usually from gorm internal, so start from 2 - len := runtime.Callers(2, pcs[:]) + // the third caller usually from gorm internal + len := runtime.Callers(3, pcs[:]) frames := runtime.CallersFrames(pcs[:len]) for i := 0; i < len; i++ { // second return value is "more", not "ok"