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

go.goroot incorrectly resolve homedir on no-windows #3586

Open
pjw91 opened this issue Nov 1, 2024 · 1 comment
Open

go.goroot incorrectly resolve homedir on no-windows #3586

pjw91 opened this issue Nov 1, 2024 · 1 comment

Comments

@pjw91
Copy link

pjw91 commented Nov 1, 2024

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:

  1. set the config listed aboved
  2. 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).

@gopherbot gopherbot added this to the Untriaged milestone Nov 1, 2024
@findleyr
Copy link
Member

findleyr commented Nov 7, 2024

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.

@findleyr findleyr modified the milestones: Untriaged, vscode-go/backlog Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants