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

Stop trimming everything before "main.go" on main packages #217

Merged
merged 5 commits into from
Mar 1, 2024

Conversation

DariaKunoichi
Copy link
Contributor

@DariaKunoichi DariaKunoichi commented Feb 28, 2024

Goal

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

Design

It's less invasive than correcting the order of trimming paths. (#211)
First trimming is performed for every package and it trims everything until the package name.
It's mostly for external packages or golang internal pkg.
Because main is a special package (pkg name is just "main" without module) we omit it in the first trimming.
Then if it's added to ProjectPackages and SourceRoot is properly configured the path will be trimmed properly.
So for input path: "/user/name/work/cmd/main.go"
current solution will provide: "main.go"
and this PR's solution will provide either "/user/name/work/cmd/main.go" or "cmd/main.go" depending of whether SourceRoot is configured.

Changeset

Skipped trimming path for "main" package.

Testing

Adjusted maze tests - for testcases that check main.go line numbers we setup SourceRoot so that main's path is trimmed correctly.

Copy link
Contributor

@tomlongridge tomlongridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DariaKunoichi DariaKunoichi merged commit 0cd4418 into next Mar 1, 2024
53 checks passed
@DariaKunoichi DariaKunoichi deleted the daria-PLAT-11584-alt branch March 1, 2024 13:38
@DariaKunoichi DariaKunoichi mentioned this pull request Mar 5, 2024
DariaKunoichi added a commit that referenced this pull request Mar 5, 2024
## 2.3.0 (2024-03-05)

### Bug fixes

* Start showing inlined functions in stack trace
  [#208](#208)

* Handle complex structs in metadata
  [#215](#215)
  [Chris Duncan](https://github.com/veqryn)

* Stop trimming everything before "main.go" on main packages
  [#217](#217)
  [Chris Duncan](https://github.com/veqryn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants