-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Set either Frame.Filename or Frame.AbsPath
Despite the name "filename", the field is supposed to contain "The path to the source file relative to the project root directory." [1] Setting Frame.Filename to filepath.Base(FrameAbsPath) is a problem because it creates ambiguous paths and may affect the "Suspect Commits" feature. Depending on how the binary is built, the Go runtime knows either the absolute path or the relative path of source files. In the general case, it can be difficult to derive a correct "project-relative" path. Code built using Go Modules can be anywhere in the file system (not only under GOPATH). GOPATH can be multiple paths. There was an attempt to trim paths in raven-go [2], but the approach there relies on GOROOT and GOPATH as configured for "future builds", and does not reflect how the running binary has been built, thus not being a good general case solution. For now we set either Filename or AbsPath depending on what is known, and we leave figuring out a relative path from an absolute path for a later improvement. [1] https://develop.sentry.dev/sdk/event-payloads/stacktrace#frame-attributes [2] https://github.com/getsentry/raven-go/blob/5c24d5110e0e198d9ae16f1f3465366085001d92/stacktrace.go#L141
- Loading branch information
1 parent
09b37a5
commit 0886a74
Showing
2 changed files
with
41 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters