Repository: golang/vscode-go

Issue #713: Include GOROOT/bin to PATH when go wasn't found from PATH
Created: 2020-09-30T15:06:46Z
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).

Duplicate issue #724: gopls: automated issue report (crash)
Created: 2020-10-01T10:04:08Z
gopls version: v0.5.0
gopls flags:
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.

panic: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: 

goroutine 116 [running]:
golang.org/x/tools/internal/lsp/debug.PrintVersionInfo.func2()
	  info.go:58  0x22e
golang.org/x/tools/internal/lsp/debug.section(0xed1240, 0xc0000eb290, 0x0, 0xd571db, 0x7, 0xc0000d8f18)
	  info.go:69  0x319
golang.org/x/tools/internal/lsp/debug.PrintVersionInfo(0xee51e0, 0xc00034b100, 0xed1240, 0xc0000eb290, 0x1, 0x0)
	  info.go:52  0x1a7
golang.org/x/tools/internal/lsp.(*Server).initialize(0xc00035c320, 0xee51e0, 0xc00034b100, 0xc0000c2000, 0x0, 0x0, 0x0)
	  general.go:87  0x58b
golang.org/x/tools/internal/lsp.(*Server).Initialize(0xc00035c320, 0xee51e0, 0xc00034b100, 0xc0000c2000, 0xc0000c2000, 0x0, 0x0)
	  server_gen.go:108  0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0xee51e0, 0xc00034b100, 0xf00360, 0xc00035c320, 0xc0000b52c0, 0xee5420, 0xc00034b080, 0x0, 0x0, 0x0)
	  tsserver.go:235  0x4bb
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0xee51e0, 0xc00034b100, 0xc0000b52c0, 0xee5420, 0xc00034b080, 0x0, 0xbfd5883fe7b62cf2)
	  protocol.go:63  0xc0
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0xee51e0, 0xc00034b100, 0xc0000b52c0, 0xee5420, 0xc00034b080, 0x0, 0x0)
	  lsprpc.go:557  0x420
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0xee51e0, 0xc00034b100, 0xc000348c80, 0xee5420, 0xc00034b080, 0x40771f, 0xc00003a5f8)
	  handler.go:35  0xd3
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc000312960, 0xc00034d8f0, 0xc0003016e0, 0xee51e0, 0xc00034b100, 0xc000348c80, 0xee5420, 0xc00034b080)
	  handler.go:103  0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x171
[Error - 1:03:43 PM] 
OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.
NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
<OPTIONAL: ATTACH LOGS HERE>

Closing comment (2020-10-01T13:07:29Z): @kkkooottt thanks for the report. This is a duplicate of #713.