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

vscode integration terminal gets incorrect version of go #2283

Closed
wushu037 opened this issue Jun 9, 2022 · 8 comments
Closed

vscode integration terminal gets incorrect version of go #2283

wushu037 opened this issue Jun 9, 2022 · 8 comments
Assignees
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@wushu037
Copy link

wushu037 commented Jun 9, 2022

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

go 1.18
vscode 1.67.2
vscode go 0.33.1

Share the Go related settings you have added/edited & Describe the bug

I have go1.17 configured with my $path$
When I wanted to use go1.18, I configured it using vscode go
As you can see in the bottom left corner, this configuration is correctly recognized and I can run my go1.18 specific generic code
But the terminal in vscode is still getting go1.17
(ps: jetbrainsIDE's terminal always correctly combines IDE external and internal environment variables, but vscode does not)

image

@gopherbot gopherbot added this to the Untriaged milestone Jun 9, 2022
@jamalc
Copy link
Contributor

jamalc commented Jun 9, 2022

Could you share the output of the command 'Go: Locate Configured Go Tools' on this issue?

Screen Shot 2022-06-09 at 10 44 18 AM

@jamalc jamalc added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 9, 2022
@wushu037
Copy link
Author

wushu037 commented Jun 9, 2022

您能否在此问题上分享命令“Go: Locate Configured Go Tools”的输出?

屏幕截图 2022-06-09 在 10 44 18 AM

Yes, the results are as follows:
image

@jamalc jamalc modified the milestones: Untriaged, v0.35.0 Jun 9, 2022
@jamalc jamalc self-assigned this Jun 9, 2022
@jamalc
Copy link
Contributor

jamalc commented Jun 14, 2022

What do you get when running echo $PATH from the integrated terminal? Want to rule out any rc file overwriting path after it has been set by vscode.

@wushu037
Copy link
Author

As follows, I also found a key problem
image

I have a feeling you may have already done something with the terminal environment variables, but there is a slight problem.
I tried a dozen times to start-up-close vscode and found that.

  • The default terminal tab at startup was able to get go1.18 several times, but not every time
  • The new terminal tabs that are created all get go1.17

@jamalc
Copy link
Contributor

jamalc commented Jun 15, 2022

That's what I'm seeing as well. This is related to a workaround we're using for microsoft/vscode#99878 on macOS. In the workaround we use a vscode.window.onDidOpenTerminal callback to update the PATH value. We removed Linux shell fallback from the workaround to fix #378 in CL 244378. I've noticed however that terminal.name is often empty until about 100ms after the vscode.window.onDidOpenTerminal callback is run.

We could add a short delay with a timeout to wait for terminal.name to be set, or reintroduce a fallback for when terminal.name is empty string. What do you think @hyangah?

@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/412314 mentions this issue: src/goEnvironmentStatus.ts: ensure terminal name before updating path

@hyangah
Copy link
Contributor

hyangah commented Jun 15, 2022

How about env.shell or terminal.creationOptions.shellPath?
Looks like python extension guesses shell from the shell path.
(The terminal.name can be anything and even can be renamed, so I now think it's best to avoid it when possible)

@wushu037
Copy link
Author

Thank you for your attention to this issue
I think it's worth fixing, otherwise executing go commands (such as go work init) would become a pain

@hyangah hyangah modified the milestones: v0.35.0, v0.34.0 Jul 12, 2022
@golang golang locked and limited conversation to collaborators Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants