Serve Laurijssen
Serve Laurijssen

Reputation: 9733

Debugging Go code in Visual Studio Code WSL

I have a Visual Studio Code environment with the Linux Subsystem for windows running and it's compiling and running a Go project just fine.

Now I'm trying to get the delve debugger running following this link:

https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code

But I can't get it running, neither remote nor local.

Tried all kind of configurations in launch.json but breakpoints just arent hit and no error message is printed.

Has anyone got go debugging running on VSCode using the WSL?

Upvotes: 10

Views: 6008

Answers (2)

VonC
VonC

Reputation: 1323573

If you can switch to WSL2, microsoft/vscode-go issue 2505 confirms:

Since WSL2 is working with this, I think we can close the bug

And WSL2 will be generally available in Windows 10, version 2004.
Windows 10 version 2004 is "20H1", because it's being released in the first half of the year 2020.

Upvotes: 1

Serve Laurijssen
Serve Laurijssen

Reputation: 9733

Old post, but its not possible to get delve to work on WSL

https://github.com/go-delve/delve/issues/1235

There was a better resource that explains fully why it doesnt work, cant find it now

Apparently it has something to do with WSL not implementing Linux fully...but it will in WSL2!

https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

Upvotes: 3

Related Questions