Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only skip GOROOT frames when GOROOT is non-empty. #12

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ func (o *OopsError) formatVerbose() string {
if stacktrace := o.Stacktrace(); stacktrace != "" {
lines := strings.Split(stacktrace, "\n")
stacktrace = " " + strings.Join(lines, "\n ")
output += fmt.Sprintf("Stackstrace:\n%s\n", stacktrace)
output += fmt.Sprintf("Stacktrace:\n%s\n", stacktrace)
}

if sources := o.Sources(); sources != "" && !SourceFragmentsHidden {
Expand Down
8 changes: 4 additions & 4 deletions stacktrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ func newStacktrace(span string) *oopsStacktrace {
}
function := shortFuncName(f)

isGoPkg := strings.Contains(file, runtime.GOROOT()) // skip frames in GOROOT
isOopsPkg := strings.Contains(file, packageName) // skip frames in this package
isExamplePkg := strings.Contains(file, packageNameExamples) // do not skip frames in this package examples
isTestPkg := strings.Contains(file, "_test.go") // do not skip frames in tests
isGoPkg := len(runtime.GOROOT()) > 0 && strings.Contains(file, runtime.GOROOT()) // skip frames in GOROOT if it's set
isOopsPkg := strings.Contains(file, packageName) // skip frames in this package
isExamplePkg := strings.Contains(file, packageNameExamples) // do not skip frames in this package examples
isTestPkg := strings.Contains(file, "_test.go") // do not skip frames in tests

if !isGoPkg && (!isOopsPkg || isExamplePkg || isTestPkg) {
frames = append(frames, oopsStacktraceFrame{
Expand Down
Loading