Skip to content

Support trimpath when debugging #2737

@hermanbanken

Description

@hermanbanken

Is your feature request related to a problem? Please describe.
I spend a few days pulling my hair out why debugging was not working via "run test | debug test", while the launch configuration did work fine. Long story short, this was my settings.json:

  "go.testFlags": [
    "-trimpath",
    "-v"
  ],

This results in file paths like /Users/hermanbanken/repos/myrepo/foobar.go:42 be rewritten to github.com/hermanbanken/myrepo/foobar.go:42. This is nice for brevity, but breaks:

  1. File Links (clicking the link in the terminal and jumping to the exact line)
  2. Debugging via run test | debug test because breakpoints reference absolute paths, and those do not match what dlv reports.

Describe the solution you'd like
A combination of any of these options:

  • Warnings when -trimpath is used in testFlags settings
  • Support for module paths in VSCode File Links (is this this extension?)
  • Support for dlv paths being module paths (is this this extension?)

Describe alternatives you've considered
For now I removed -trimpath and my debugging flow works again.

Related to microsoft/vscode-go#1935.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions