-
Notifications
You must be signed in to change notification settings - Fork 745
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
Statusbar indicates wrong Go version #2219
Comments
From the log in the report, I see that the vscode was launched with the above path. No go1.18 path present when the extension started. This log message tells the
This extension has no knowledge of what Last time I checked microsoft/vscode#46846 I couldn't find a good way of solving it. |
Reading the code, all nix-env-selector does is load the environment using nix-shell, parse the environment variables from it, and sets them on It is set to first activate on all VS Code events and loads quickly so it has the highest chance to load first/near the beginning, but indeed, it seems there's no way to guarantee the Go extension will load after it. Is this PATH "vscode launched with" something that is captured at the time of Go extension init, or is it a separate variable that VS Code makes available (as in, the PATH that vscode truly launched with, before any extension loaded) and the Go extension prefers over the current process.env? If the latter, why does it do that? If not, then there would probably be a need for something like a synchronous load order API or user setting in VS Code, to allow specific extensions to fully activate in a specific order before everything else. |
It's If it's safe to assume However, given that the code was introduced long ago and this is referenced in many places in very subtle ways, I wouldn't be surprised if it is not as easy as it seems. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Removing go.alternateTools changes nothing, it was just an attempt to get the plugin to look properly into the PATH instead of doing whatever it's doing.
Describe the bug
The status bar at the bottom indicates the wrong Go version. I am using Nix Env Selector to load a nix shell full of development tools into the VS Code environment, including Go 1.18, which is reflected by the right gopls running which is evidenced by both Go 1.18-specific syntax being recognized, and by the following log in the Electron Console:
However, the version selector seems to be getting tools from a different PATH, showing instead Go 1.17, which is the version my system has globally installed, and, while present in PATH, it should've been overridden by the folder
/nix/store/ngv92md1x8fvay76v85biablz7wvlbj4-go-1.18/bin
which is earlier in my PATH:/nix/store/9chsm1gqvvpqywz219s1rknfrzr5xjfz-patchelf-0.14.3/bin:/nix/store/jz10kjr0lnhynwxnrzv4kcwbjs5s0ri8-gcc-wrapper-10.3.0/bin:/nix/store/finlf6zyxhpqi8hp2p4fgxkgqvjp6l78-gcc-10.3.0/bin:/nix/store/drb5a0j2z8fh6bivl9aq15fbfmrx62kb-glibc-2.33-117-bin/bin:/nix/store/2w6011wwg5v6qxz182r4d0mmr3i4rxm1-coreutils-9.0/bin:/nix/store/55ayck4pllh4qallb1dbhbkrzwrrl02r-binutils-wrapper-2.35.2/bin:/nix/store/x2zbyl2l4xayv4d5is0b31plfq8xjjym-binutils-2.35.2/bin:/nix/store/xgibf1z6b7zx4h1hv3v8qw0f2n1jv4pm-gnumake-4.3/bin:/nix/store/ngv92md1x8fvay76v85biablz7wvlbj4-go-1.18/bin:/nix/store/xb0pwk6pjcy0akxsnq3rlc8aijr8v2r8-buf-1.3.0/bin:/nix/store/xsyxl03j9k5cnrnzpffd2ccykn5q8kv7-clang-tools-13.0.1/bin:/nix/store/2w6011wwg5v6qxz182r4d0mmr3i4rxm1-coreutils-9.0/bin:/nix/store/pr0l0cwak2dprcvvzqvli1kkpg7k9fci-findutils-4.9.0/bin:/nix/store/c5xa1n6bl34gxfmjlqgaxdyk4i583fk5-diffutils-3.8/bin:/nix/store/jdhk02s01ca02qv083f41wz8jj25gybc-gnused-4.8/bin:/nix/store/3fvq0jjjh50vh0rlqr2xc9ya8llcj113-gnugrep-3.7/bin:/nix/store/i4mm5ycljiq465ncr29mg9bf7wn18i8c-gawk-5.1.1/bin:/nix/store/4rypjibv28cbbg21apsqnnyi3k2glzjd-gnutar-1.34/bin:/nix/store/660k06nr64g3fqndivn6brmk8ly7ivdz-gzip-1.11/bin:/nix/store/rmxjjpg43f6jssh82q29q21lzlcqzwxz-bzip2-1.0.6.0.2-bin/bin:/nix/store/xgibf1z6b7zx4h1hv3v8qw0f2n1jv4pm-gnumake-4.3/bin:/nix/store/dndi916j6yxzfzzj2sma2llhrlwahq06-bash-5.1-p16/bin:/nix/store/agfkd1d9mmcniwrvh10afn054x1n8iqi-patch-2.7.6/bin:/nix/store/45j7wibbdckl5f50bs5nq7damhy8cahp-xz-5.2.5-bin/bin:/home/mixedcase/.local/share/npm-packages/bin:/nix/store/xl4fcwa76r0xy59dlhjvvj7h0nl0ix84-glib-2.72.0-bin/bin:/home/mixedcase/bin:/run/wrappers/bin:/home/mixedcase/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/mixedcase/.nix-profile/bin:/etc/profiles/per-user/mixedcase/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
(first bold is what it should be using, last bold is where it's getting it from)
My guesses are that:
a) The version selector is reading PATH wrong.
b) It is hooking its initialization before Nix Env Selector for some reason, and this makes it pick up the wrong PATH.
A successful workaround for this is to load the Nix environment inside a terminal and launching VS Code from there, which makes me think option b is more likely.
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: