bugsnag / bugsnag-go

Automatic panic monitoring for Go and Go web frameworks, like negroni, gin, and revel
https://docs.bugsnag.com/platforms/go
MIT License
204 stars 69 forks source link

Fix the order of trimming paths of inProject files #211

Closed DariaKunoichi closed 7 months ago

DariaKunoichi commented 8 months ago

Goal

In case of different main files it's impossible to differentiate where the error came from.

Design

Current implementation WITHOUT setting SourceRoot and ProjectPackages produces event like this:

Screenshot 2024-02-22 at 17 24 00

Current implementation WITH configuration:

Screenshot 2024-02-22 at 17 43 43

Changes in this PR WITHOUT any configuration:

Screenshot 2024-02-22 at 17 26 00

Changes in this PR with SourceRoot configured:

Screenshot 2024-02-22 at 17 26 58

Changes in this PR with SourceRoot and ProjectPackages configured:

Screenshot 2024-02-22 at 17 38 37

Changeset

If the file is in project trim SourceRoot from the filepath, for outsider files trim GOROOT and GOPATH if they are set. It's impossible to get SourceRoot programmatically at runtime. We can get info about module to add to ProjectPackages along with main but it will work only if called from main file.

Testing

-

DariaKunoichi commented 7 months ago

Won't merge for now