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

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

Closed
rbtcollins opened this issue Jan 18, 2021 · 6 comments
Closed

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

rbtcollins opened this issue Jan 18, 2021 · 6 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@rbtcollins
Copy link

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.

@hyangah
Copy link
Contributor

hyangah commented Jan 19, 2021

@rbtcollins thanks for the report.
I want to understand what's going on here.

Is your goal to use a different version (1.14.13) of Go from your integrated terminal while your extension is using 1.15.6 for the language server, analysis, testing, and debugging by default?

Or was the intention to use 1.14.13 for the project, but the extension picked up 1.15.6 despite you set 1.14.13 as the go.goroot (that's not how I expected the extension to behave so it's likely a bug).

@hyangah hyangah added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 19, 2021
@rbtcollins
Copy link
Author

The goal was to use 1.14.13 for the project, for the toolchain, and for the integrated terminal.

My desktop is a Windows 10 Professional. The Go environment is an Ubuntu VM being accessed via the Remote-SSH extension, if that helps.

@gopherbot gopherbot added this to the Untriaged milestone Apr 8, 2021
@stamblerre stamblerre modified the milestones: Untriaged, Backlog Apr 9, 2021
@hyangah
Copy link
Contributor

hyangah commented Apr 13, 2021

@rbtcollins My apologies. This issue fell through the cracks and I failed to follow up. :-(

Can you please verify if the in-vscode tool invocation is actually using the 1.14.13 ?

  • Set "go.logging.level": "verbose" from the setting -> "Developer: Reload Window" from Command Palette -> "Developer: Toggle Developer Tools" -> Filter by "Go [V]" -> Share the output.

Screen Shot 2021-04-13 at 1 49 27 PM

  • Run Go: Locate Configured Go Tools command and check the output (GOROOT).

The PATH modification for shell happens only when the go binary to be used by the extension can't be found in PATH. I originally thought this was related to #776 (go.goroot doesn't mutate GOROOT env var), but in this case, it seems like go.goroot wasn't used to pick the right go binary. So it looks different.

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/336409 mentions this issue: package.json: add go.terminal.activateEnvironment setting

@huanghantao
Copy link

I have the same problem, what is the solution now? I can't get goenv and vscode to work properly using SSH remote.

@hyangah
Copy link
Contributor

hyangah commented Mar 20, 2022

@huanghantao As shown in the cl title of the last comment, go.terminal.activateEnvironment setting was added to disable.

@golang golang locked and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants