Skip to content

adding go runtime base to PATH interacts very badly with goenv #1098

@rbtcollins

Description

@rbtcollins

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

$ code -v
1.52.1
ea3859d4ba2f3e577a159bc91e3074c5d85c0523
x64

  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.20.0

Consider this path:

echo $PATH
/home/robertc/.pyenv/plugins/pyenv-virtualenv/shims:/home/robertc/.pyenv/shims:/home/robertc/.goenv/versions/1.15.6/bin:/home/robertc/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/bin:/home/robertc/.pyenv/plugins/pyenv-virtualenv/shims:/home/robertc/.pyenv/shims:/home/robertc/.goenv/shims:/home/robertc/.goenv/bin:/home/robertc/.cargo/bin:/home/robertc/.pyenv/bin:/home/robertc/bin:/home/robertc/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Note that go 1.15.6 is in the path.

In .vscode/settings.json:

    "go.goroot": "/home/robertc/.goenv/versions/1.14.13",
    "go.gopath": "/home/robertc/go/1.14.13",

But yet, from the same directory from a shell not spawned under vs-code:

$ goenv local
1.14.13
$ go version
go version go1.14.13 linux/amd64

As far as I can tell, the in-vscode tool invocation is using the override 1.14.13 root/path etc; the shell is not only because vscode is adding 1.15.6 to the path (which you can tell is vscode because it is before the vscode-server entry in the path).

Making this optional would be a great help to those of us using goenv to manage multiple go versions and switch between them - we usually have the right GOROOT, a sane GOPATH etc, and need to have the shim entry in PATH, not the runtime base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions