-
Notifications
You must be signed in to change notification settings - Fork 763
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
Windows10 + WSL Error: "Error loading workspace folders (expected 1, got 0) failed to load view for: file:////wsl$/Ubuntu/wsl$/Ubuntu/home/<path to project folder>" #1574
Comments
I think this extension needs the Visual Studio Code Remote - WSL extension for developing in WSL (like many other extensions). Please review VS Code's documentation about Developing in WSL. |
Thank you for the prompt reply. I have reviewed said guides and followed them to the letter. I doublechecked that I'm using the latest and greatest version of associated extensions as you can see in the screenshot. Still the issue persists if and only if I place the git repository inside the WSL file system. |
I think the problem may occur if windows git binary try to access git repo cloned inside wsl with Ubuntu git and wise versa. |
Thank you @wtask for the tip, and @dsidirop for filing the issue. Now I see more and more Go users using WSL. Working in WSL needs a specific setup to work, I think it deserves a section in docs/troubleshooting.md or a separate doc (docs/developing-in-wsl.md maybe?). Edit: filed #1575 for documentation and labeled it as help-wanted. |
I have copy-pasted the git-repo of my windows machine into WSL. I will try a fresh-clone and see if things improve. Thank you for the quick tip! Update: Re-cloned the git repos afresh inside WSL using WSL's git but the issue persists. Was worth a try though. |
But VSCode may use Windows git binary |
Quick clarification: I cloned the repos using the vanilla bash-terminal + git clone inside WSL (no VSCode involved). Was there something better I could do? Please instruct. |
Your project setup depends on your targets. I don't know them.
The Windows tools (except sqlc) I launch from Ubuntu:
And finally I use VSCode for Windows and have no issues with WSL. The Remote Development extension is not necessary in my case. |
@dsidirop: Can you please share your workspace file? The workspace URI should include 3 slashes after |
@stamblerre The workspace file would look like this:
This @dsidirop I opened code from Ubuntu/WSL (installed code, git, go inside the container, and also cloned my repo inside the container). I used Remote - WSL (part of the MS Remote Development pack) and it worked without any issue. If I attempt to open the folders directly from Windows, I encounter the same issue. ps. the workspace settings equivalent with the above workspace setting when using the remote dev extension pack would look like the following
and |
@hyangah Did you open code.exe or Ubuntu binary? Does WSL support Linux GUI already? I'm outdated now. |
@wtask I am new to WSL2 and followed this tutorial (https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-vscode). A year old but it still seems to work. I had code installed on windows already. Today I followed this instruction https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-vscode#from-the-command-line and just ran Disclaimer: I had to install Once this is done, if I launch |
Okay, WSL version doesn't important in that case. You work with easy accessible VM which is Linux from Windows. And you should understand what you do and why. Unfortunately, I do not fully understand the problem, namely, what the user wants to do. Write code entirely in Linux from under Windows? |
@wtask https://code.visualstudio.com/docs/remote/wsl has the architecture. The Go extension needs to be installed on the server side too and VS Code lists extensions installed locally & remotely separately. |
If you have installed code already under Windows better to add executable script somewhere inside Ubuntu which will be available through Path with name
|
@hyangah Ok, may be you should not use local (Windows) filesystem to save workspace started from WSL? |
@dsidirop is it possible to avoid use of |
Write code stored in the Linux filesystem (WSL) using VSCode. Simple as that. |
This is how my workspace file looks like:
Can you make a similar workspace file and try to reproduce the issue? |
@dsidirop The Remote-WSL extension needs to be explicitly activated if you want to open the workspace. Here is the step I followed.
Or, if you run There could be a simpler way to access a workspace for WSL but I don't know. I am not sure what else this extension can do here. |
Closing since we don't find any actionables here. |
UPDATE:
After all this analysis I realized that the go-language-server will work as intended if and only if I launch VSCode from within WSL. So to achieve that nowadays I open a WSL bash prompt and simply type 'code ./path/to/workspace/file.code-workspace' and when I do that VSCode is launched from within WSL (in the lower left corner of VSCode one can see the term 'WSL' clearly visible when VSCode is indeed running within WSL).
This might be a peculiarity on my own setup but it's clearly the difference that makes the difference in my case.
Please answer these questions before submitting your issue. Thanks!
What version of Go, VS Code & VS Code Go extension are you using?
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.golang.org/x/tools/gopls master
golang.org/x/tools/gopls@v0.6.11 h1:7S2k0xuVYc3secjy2uz0n+fGYxGJU6gXsLOmQ/r1HoI=
github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/google/go-cmp@v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/mod@v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sys@v0.0.0-20210521203332-0cec03c779c1 h1:lCnv+lfrU9FRPGf8NeRuWAAPjNnema5WtBinMgs1fD8=
golang.org/x/tools@v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs=
golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
honnef.co/go/tools@v0.1.3 h1:qTakTkI6ni6LFD5sBwwsdSO+AQqbSIxOauHTTQKZ/7o=
mvdan.cc/gofumpt@v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
Run
code -v
orcode-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.GOBIN: undefined
toolsGopath:
gopath: C:\Users\Dominic\go
GOROOT: C:\Program Files\Go
PATH: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Python39\Scripts;C:\Python39;C:\PROGRAM FILES\MICROSOFT MPI\BIN;C:\PROGRAM FILES\GITLAB RUNNER;C:\PYTHON27\SCRIPTS;C:\PYTHON38\SCRIPTS;C:\PYTHON38;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WINDOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0;C:\WINDOWS\SYSTEM32\OPENSSH;C:\PROGRAM FILES (X86)\ATI TECHNOLOGIES\ATI.ACE\CORE-STATIC;C:\PROGRAM FILES\DOTNET;C:\PROGRAM FILES\MICROSOFT SQL SERVER\130\TOOLS\BINN;C:\PROGRAM FILES\MICROSOFT SQL SERVER\CLIENT SDK\ODBC\170\TOOLS\BINN;C:\PROGRAM FILES\MICROSOFT VS CODE\BIN;C:\PROGRAMDATA\CHOCOLATEY\BIN;C:\PROGRAMDATA\CHOCOLATEY\LIB\MAVEN\APACHE-MAVEN-3.6.3\BIN;C:\PROGRAM FILES\OPENJDK\OPENJDK-8U242-B08\BIN;C:\PROGRAM FILES (X86)\AMD\ATI.ACE\CORE-STATIC;C:\PROGRAM FILES\GIT\CMD;C:\PROGRAM FILES (X86)\NVIDIA CORPORATION\PHYSX\COMMON;C:\PROGRAM FILES\NVIDIA CORPORATION\NVIDIA NVDLISR;C:\PROGRAM FILES (X86)\AMD APP SDK\3.0\BIN\X86_64;C:\PROGRAM FILES (X86)\AMD APP SDK\3.0\BIN\X86;C:\PROGRAM FILES\MICROSOFT SQL SERVER\CLIENT SDK\ODBC\130\TOOLS\BINN;C:\PROGRAM FILES (X86)\OPENJDK\JDK-14.0.1\BIN;C:\PROGRAM FILES (X86)\OPENJDK\OPENJDK-8U252-B09\BIN;C:\PROGRAM FILES\DOCKER\DOCKER\RESOURCES\BIN;C:\PROGRAMDATA\DOCKERDESKTOP\VERSION-BIN;C:\PROGRAM FILES\VAULT;C:\PROGRAM FILES\SEQ;C:\PROGRAM FILES\SEQ\CLIENT;C:\PROGRAM FILES (X86)\GOOGLE\CLOUD SDK\GOOGLE-CLOUD-SDK\BIN;C:\PROGRAM FILES (X86)\MICROSOFT SQL SERVER\150\TOOLS\BINN;C:\PROGRAM FILES\MICROSOFT SQL SERVER\150\TOOLS\BINN;C:\PROGRAM FILES\MICROSOFT SQL SERVER\150\DTS\BINN;C:\PROGRAM FILES (X86)\MICROSOFT SQL SERVER\150\DTS\BINN;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin;C:\Program Files\Nuget;;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files (x86)\dotnet;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\PuTTY;C:\Program Files\Amazon\AWSCLIV2;C:\Program Files\Go\bin;C:\Program Files (x86)\GitExtensions;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.1\bin;C:\Program Files\OpenJDK\jdk-16.0.1\bin;C:\Program Files\OpenJDK\openjdk-8u292-b10\bin;C:\Users\Dominic\AppData\Local\Microsoft\WindowsApps;C:\Users\Dominic.dotnet\tools;C:\Users\Dominic\AppData\Local\Keybase;C:\Users\Dominic\AppData\Roaming\npm;C:\Users\Dominic\AppData\Local\Yarn\bin;C:\Users\Dominic\AppData\Local\GitHubDesktop\bin;C:\Users\Dominic\go\bin;C:\Users\Dominic\AppData\Local\Markdown Monster;C:\Users\Dominic.dotnet\tools;C:\Users\Dominic\go\bin
gopkgs: C:\Users\Dominic\go\bin\gopkgs.exe installed
go-outline: C:\Users\Dominic\go\bin\go-outline.exe installed
gotests: C:\Users\Dominic\go\bin\gotests.exe installed
gomodifytags: C:\Users\Dominic\go\bin\gomodifytags.exe installed
impl: C:\Users\Dominic\go\bin\impl.exe installed
goplay: C:\Users\Dominic\go\bin\goplay.exe installed
dlv: C:\Users\Dominic\go\bin\dlv.exe installed
dlv-dap: C:\Users\Dominic\go\bin\dlv-dap.exe installed
staticcheck: C:\Users\Dominic\go\bin\staticcheck.exe installed
gopls: C:\Users\Dominic\go\bin\gopls.exe installed
go env
Workspace Folder (magellan-streaming-broker): \wsl$\Ubuntu\home\dominic\VS\laerdal\magellan-streaming-broker
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Dominic\AppData\Local\go-build
set GOENV=C:\Users\Dominic\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Dominic\go\pkg\mod
set GONOPROXY=bitbucket.org/laerdalmedical
set GONOSUMDB=bitbucket.org/laerdalmedical
set GOOS=windows
set GOPATH=C:\Users\Dominic\go
set GOPRIVATE=bitbucket.org/laerdalmedical
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.5
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=\wsl$\Ubuntu\home\dominic\VS\laerdal\magellan-streaming-broker\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Dominic\AppData\Local\Temp\go-build3943144360=/tmp/go-build -gno-record-gcc-switches
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"]
orgopls
prefixes.<nothing in my settings.json file prefixed with go*>
Describe the bug
I'm using VSCode+Go extension in Windows 10 + WSL2 (all fully updated to their latest versions).
Regardless of whether I open a golang folder/project directly as a folder or via a workspace file hosted inside the WSL's filesystem (file:////wsl$/Ubuntu/wsl$/Ubuntu/home/...) I get the same error upon launching VSCode:
The files are navigable inside the file-explorer in the sidebar but static code analysis + code helpers (go to implementation, find usages) doesn't work at all. This shouldn't happen. If I copy the exact same folder into the Windows NTFS filesystem (C:\foo\bar) then VSCode + Go-Extension opens the folder just fine with full static analysis + code-helpers working 100% as intended.
The strange thing about this is that I'm the only one in my team who is experiencing this kind of error. Colleagues of mine running the same setup don't have such issues. The only difference between our machines is that I'm running BitDefender antivirus. I doubt BitDefender plays any role though.
Things I've tried:
Steps to reproduce the behavior:
Screenshots or recordings
The text was updated successfully, but these errors were encountered: