Skip to content

Include GOROOT/bin to PATH when go wasn't found from PATH #713

Closed
@hyangah

Description

@hyangah

The fix for #679 change to prepend GOROOT/bin to PATH or Path only if users explicitly configured to use go different from what's found from PATH. I forgot the case where go was not found from PATH, so the extension guessed and picked up a common default go installation directory. (C:\Go\bin or /usr/local/go/bin).

This is a regression and needs fix.

As a result, underlying tools such as gopls or delve that searches only PATH failed to locate the go binary. gopls crashes in this case.

For users who encountered this issue: You can try one of the followings for now:

Please try out https://github.com/golang/vscode-go/releases/tag/v0.17.2-rc.1
There is an instruction.

If it doesn't fix the issue, please update this issue.

Meanwhile, you can try one of the followings:

  • Option 1) downgrade to 0.17.0 for now (Extension view -> select 'Go' extension -> click the gear icon -> install another version -> select 0.17.0), or

  • Option 2) add "go.goroot": "/usr/local/go" temporarily until 0.17.1 is out, or

  • Option 3) add /usr/local/go/bin to your PATH and relaunch code for linux/mac users. C:\Go\bin to Path for windows users.

I recommend the Option 3


Edit: For people who wonder why VS Code reports a different PATH than what you see from the terminal:

When vscode launches for the first time, it initializes the environment like a login shell (~/.profile/~/.bash_profile/~/.zprofile ). When you try echo $PATH from the terminal, the shell environment may be set for interactive shell env (.bashrc, etc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions