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

debug: inconsistent workspaceFolder value for cwd #1448

Closed
ThinkChaos opened this issue Apr 22, 2021 · 1 comment
Closed

debug: inconsistent workspaceFolder value for cwd #1448

ThinkChaos opened this issue Apr 22, 2021 · 1 comment
Assignees
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Milestone

Comments

@ThinkChaos
Copy link

(I moved version info after as it doesn't seem relevant)

Describe the bug

workspaceFolder is expanded to different values during the same run depending on where it is used.
Having the variable in both program and cwd doesn't always result in the same value. I took a quick look at the code of this plugin and workspaceFolder is expanded if it is in cwd during resolveDebugConfiguration: goDebugConfiguration.ts#L171. The comments above mention expanding ~, but resolvePath also expands workspaceFolder (see util.ts#L641).
I believe the call to resolvePath should be replaced with resolveHomeDir so that VS does the worspaceFolder expansion on its own which would ensure consistency.

Steps to reproduce the behavior:

This is a rough description of a setup that triggers the bug:

  1. Create a workspace for a go package
  2. Add a folder to the workspace which is separate from the go package dir
  3. Create a debug config in launch.json where program and cwd contain ${workspaceFolder}
  4. Set go.alternateTools: dlv in extension settings to the path of a script containing the following:
#!/bin/sh
echo pwd "$(pwd)"
echo dlv "$@"

When launching the debug session, you should see that pwd (expanded from program) and the --wd arg passed to dlv (expanded from cwd) didn't use the same workspaceFolder value.

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.16.2 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.6.10
    golang.org/x/tools/[email protected] h1:8Ebz8PymS2umcuCFhoz67unyJfWsipjTIrkBUF9kypg=
    github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/[email protected] h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
    golang.org/x/[email protected] h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
    golang.org/x/[email protected] h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
    golang.org/x/[email protected] h1:B+9Jhwu5uM+kDMAkoQH6IUoIoS48VbRqwLyceNdpRK8=
    golang.org/x/[email protected] h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/[email protected] h1:qTakTkI6ni6LFD5sBwwsdSO+AQqbSIxOauHTTQKZ/7o=
    mvdan.cc/[email protected] h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
    mvdan.cc/xurls/[email protected] h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.55.2
3c4e3df9e89829dce27b7b5c24508306b151f30d
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.24.2
@gopherbot gopherbot added this to the Untriaged milestone Apr 22, 2021
@findleyr findleyr added the Debug Issues related to the debugging functionality of the extension. label Apr 22, 2021
@suzmue suzmue self-assigned this Apr 22, 2021
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/312690 mentions this issue: src/goDebugConfiguration.ts: replace resolvePath with resolveHomeDir

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants