From d4a45b1b4225187940c546828ac7db102ddda810 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Fri, 6 Dec 2024 10:49:13 +0100 Subject: [PATCH] fix(stacktrace): partial revert of #ad72a71 where we changed the way to exclude oops stack from stacktrace --- stacktrace.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stacktrace.go b/stacktrace.go index 4587ca1..f2709d4 100644 --- a/stacktrace.go +++ b/stacktrace.go @@ -2,8 +2,8 @@ package oops import ( "fmt" + "reflect" "runtime" - "runtime/debug" "strings" ) @@ -13,10 +13,12 @@ import ( /// -> Apache 2.0 LICENSE /// +type fake struct{} + var ( StackTraceMaxDepth int = 10 - buildInfo, _ = debug.ReadBuildInfo() + packageName = reflect.TypeOf(fake{}).PkgPath() ) type oopsStacktraceFrame struct { @@ -99,7 +101,6 @@ func newStacktrace(span string) *oopsStacktrace { } function := shortFuncName(f) - packageName := buildInfo.Path packageNameExamples := packageName + "/examples/" isGoPkg := len(runtime.GOROOT()) > 0 && strings.Contains(file, runtime.GOROOT()) // skip frames in GOROOT if it's set