Draft: Print full stack for executed queries

This commit is contained in:
Gerald Wagner 2025-05-21 10:27:03 +02:00
parent ccdd740abf
commit 2e7a1e3abe

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"regexp" "regexp"
"runtime" "runtime/debug"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -175,13 +175,7 @@ func toQueryValues(values [][]interface{}) (results []interface{}) {
} }
func fileWithLineNum() string { func fileWithLineNum() string {
for i := 2; i < 15; i++ { return fmt.Sprintf("Stack trace:\n%s", debug.Stack())
_, file, line, ok := runtime.Caller(i)
if ok && (!goSrcRegexp.MatchString(file) || goTestRegexp.MatchString(file)) {
return fmt.Sprintf("%v:%v", file, line)
}
}
return ""
} }
func isBlank(value reflect.Value) bool { func isBlank(value reflect.Value) bool {