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

bug #971 is referenced by a current warning message, but is closed without a fix #1887

Open
rbtcollins opened this issue Nov 10, 2021 · 5 comments
Labels
Documentation upstream-vscode Issues that are by problems in VS Code itself.

Comments

@rbtcollins
Copy link

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

Version Information

goenv:

goenv version
1.15.4 (set by /home/robertc/.goenv/version)

go version:

go version go1.15.4 linux/amd64

gopls -v version

Build info
----------
golang.org/x/tools/gopls v0.7.3
    golang.org/x/tools/[email protected] h1:Lru57ht8vtDMouRskFC085VAjBAZRAISd/lwvwOOV0Q=
    github.com/BurntSushi/[email protected] h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/[email protected] h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
    golang.org/x/[email protected] h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
    golang.org/x/[email protected] h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
    golang.org/x/[email protected] h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
    golang.org/x/[email protected] h1:hk7xRoeg0CG1nRLsd5BZLDUgVpA9bnKylGk1p2/BPH0=
    golang.org/x/[email protected] h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/[email protected] h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=
    mvdan.cc/[email protected] h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
    mvdan.cc/xurls/[email protected] h1:59Olnbt67UKpxF1EwVBopJvkSUBmgtb468E4GVWIZ1I=

code -v

f4af3cbf5a99787542e2a30fe1fd37cd644cc31f
x64

extension: 0.29.0

Locate configured go tools:

Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: undefined
GOROOT: 
PATH: /home/robertc/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/home/robertc/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

unable to locate "go" binary in GOROOT () or PATH (/home/robertc/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/home/robertc/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin)

Note that the PATH is wrong: this is what it is in the terminal:

/home/robertc/.goenv/versions/1.15.4/bin:/home/robertc/bin/google-cloud-sdk/bin:/home/robertc/bin/apache-maven-3.6.3/bin:/home/robertc/bin:/home/robertc/.cargo/bin:/home/robertc/.nvm/versions/node/v13.13.0/bin:/home/robertc/.goenv/shims:/home/robertc/.goenv/bin:/home/robertc/.pyenv/shims:/home/robertc/.pyenv/bin:/home/robertc/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/home/robertc/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/robertc/go/1.15.4/bin

Share the Go related settings you have added/edited

go settings

  "go.coverOnSave": true,
    "go.formatTool": "goimports",
    "go.lintTool": "golangci-lint",
    "editor.formatOnSave": true,
    "go.testOnSave": true,

Describe the bug

I am encountering the symptoms of closed bug #971 That bug has no long term solution implemented, just a hardcoded path lookup for an alternative concrete location.

If the bug is really fixed, perhaps remove the 'temporary' reference to the bug from the error message. If it isn't, perhaps reopen the bug (and close this as a dupe),... or perhaps turn this into the current iteration of this bug.

@gopherbot gopherbot added this to the Untriaged milestone Nov 10, 2021
@aengelhorn
Copy link

aengelhorn commented Nov 10, 2021

Same problem, same VS Code version here, using Windows with VS Code running in WSL (debian). The path shown seems to be the content of the windows path instead of the linux path which contains the go installation.

@hyangah
Copy link
Contributor

hyangah commented Nov 10, 2021

The extension inherits the PATH or Path used by the VS Code process - unfortunately, that can be different from what you see from the integrated terminal (that runs your login shell on top of the VS Code process environment).

The hard coded path was used as the last resort only when PATH available to the extension doesn't contain valid Go. The warning message should show the path the extension is seeing. If it doesn't include the path, please open an issue to VS Code repo (describing how you launched your vscode process and the vscode version).

@hyangah
Copy link
Contributor

hyangah commented Nov 10, 2021

BTW can you please check the VS Code version? I just found microsoft/vscode#136791 that may be relevant (so VS Code failed to compute the right shell environment and broke WSL mode too)

@aengelhorn
Copy link

VS Code version 1.62 introduced the error, so downgrading to 1.61.2 fixed that for me.

@ickymettle
Copy link

ickymettle commented Nov 10, 2021

I ran into this today and managed to figure out a fix, i'm using zsh so the examples here are for remote zsh shells, but likely the same behaviour happens with bash, i'm also using asdf to manage my local development tools.

vscode connects to the remote server over a non-interactive shell, non-interactive shells only source .zprofile (not .zshrc), if you're setting paths in .zshrc they won't be set in the environment that the remote code server is running in. To fix this I created a .zprofile that sets up the minimal environment I needed to get my development tools into the path, eg:

if [[ ! -o interactive ]]; then
  source $HOME/.asdf/asdf.sh
  export GOPATH="$HOME/go"
fi

Once you've added this you need to kill the remote server, it will restart on next new connection and source .zprofile picking up the changes. You can kill it via cmd+shift+P and running Remote-SSH: Kill VS Code on remote server .... You can also kill the node process on the remote manually too.

For bash rather than .zprofile you can probably pop your env setup in .bash_login instead but i've not tested that.

@hyangah hyangah added upstream-vscode Issues that are by problems in VS Code itself. Documentation labels Nov 10, 2021
@hyangah hyangah modified the milestones: Untriaged, Unplanned Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation upstream-vscode Issues that are by problems in VS Code itself.
Projects
None yet
Development

No branches or pull requests

5 participants