Goland WSL2 Run Configuration

Completed

Hello,

  I have been trying to run my code in WSL2 using Go I also installed in WSL2.

  Within WSL2, everything works, but when I try to create a Run configuration within GoLand, the Run On section never shows up. In Tools->Manage Targets, I am able to create the WSL target, but I cannot seem to find a way to hook it up to a Run configuration.

  I have GoLand 2021.3.2.

  Please advise...

Thanks,

Ron

0
9 comments
Official comment

Hello Ron,

You don't need to use Run Targets feature if you opened a project inside WSL2 mount. You can create Go Build configuration manually or use gutter icons over main() function to create it automatically. After that, GoLand will execute your program in WSL2 environment.

Please see: https://blog.jetbrains.com/go/2021/09/24/goland-2021-3-early-access-program-is-now-open/#native-support-for-go-projects-in-wsl-2

Please, let me know if it helps.

Avatar
Permanently deleted user

Thank you for the quick response. I looked at the blog and those steps don't work for me. I am able to make that native approach work for PyCharm WSL2, but not for GoLand. I have WSL2 go 1.17.5 if that matters.

The reason why I even tried the Managed Targets was because I can't seem to create a Run Configuration that has the play button enabled after I create it.

The gutter icons also don't come up over the main function that I can use to kick off a run or a debug.

So bottom line, the problem I have is I can't run anything from GoLand for both options.

Thoughts?

0

Let's start with the IDE logs to get a bit more information about your current environment. You can collect them via Help | Collect Logs and Diagnostic Data and upload them to https://uploads.jetbrains.com/, then provide its ID.

You can try to create a new Go modules project in WSL2 and add main.go file with the following content:

package main

import "fmt"

func main() {
fmt.Println("Hello, WSL2 projects!")
}

After that, try to run main() function using gutter icons.

0
Avatar
Permanently deleted user

Thanks. The upload ID is Upload id: 2022_01_08_8Zjjr7W76cP6bMZU (file: goland-logs-20220107-16070516739294479764003215.zip).

I tried to do that, but the gutter icons don't show up in the IDE so I am not able to make it execute.

Thanks,

Ron

0

Thank you.

Could you please provide a screenshot with a code snippet that I've posted and missing gutter icons?

0
Avatar
Permanently deleted user

Hello,

  Please see the image below.

  Take note that in the selected Run configuration, the Play button is not enabled.

Thanks,

Ron

0

Hello,

Please, download GoLand Nightly via Toolbox App or try the following workaround:  https://youtrack.jetbrains.com/issue/IDEA-286059#focus=Comments-27-5686567.0-0. Does it help?

0
Avatar
Permanently deleted user

Thanks. The workaround indeed fixed my problem.

I am able to run now. For my information, what do I lose by disabling this feature? And it sounds like it is fixed with the nightly build and should be in the next stable release?

Out of curiosity, what was the issue? Since this seems like basic functionality, did it have something to do with my system being on Windows 11?

Thanks,

Ron

0

You're right, it is a problem in the current stable release and should be fixed in the next one. Please see GO-12202 and this comment for details.

0

Please sign in to leave a comment.