What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_.
-
* Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_.
-
* Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders.
-
* Check your installed extensions to get the version of the VS Code Go extension
-
* Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command.
-
Share the Go related settings you have added/edited
Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.
{"go.goroot": "~bbb/.goenv/versions/1.23.0"}
Describe the bug
When running VSCode as user aaa with the config listed above,
a notification says "cannot find go binary in /home/aaa/bbb/.goenv/versions/1.23.0".
Steps to reproduce the behavior:
set the config listed aboved
enter a golang project
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
Diagnosis
In setGOROOTEnvVar > resolvePath > resolveHomeDir, the function resolveHomeDir merely replace the character ~ to $HOME without consulting the /etc/passwd to get the homedir of user:bbb (the directory ~bbb refers to).
Thank you for diagnosis. It sounds like the handling for ~ is ad-hoc, and does not support the ~bbb syntax. This is very unlikely to get fixed any time soon. Sorry.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. -
Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file. Share all the settings with thego.
or["go"]
orgopls
prefixes.Describe the bug
When running VSCode as user
aaa
with the config listed above, a notification says "cannot find go binary in /home/aaa/bbb/.goenv/versions/1.23.0".Steps to reproduce the behavior:
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
Diagnosis
In
setGOROOTEnvVar > resolvePath > resolveHomeDir
, the functionresolveHomeDir
merely replace the character~
to$HOME
without consulting the/etc/passwd
to get the homedir of user:bbb (the directory~bbb
refers to).