Running applications in Go Playground
You can run your Go code in GoLand by using the Go playground server to process it. When you use the Open in | Playground action, GoLand creates a scratch file with your code and displays a toolbar that contains the same options that you see in the Go playground.
You can format and share your code, change the Go version, run your code by using the Go playground server, or run it locally.
GoLand displays a toolbar with the Go Playground controls for Go scratch files.
Running your code in the Go Playground
Select code that you want to run in the Go Playground.
Right-click the selection and navigate to
.Click the Run icon () on the toolbar.
Note: if you run your code from the context menu or from the gutter, GoLand runs your code locally. Also, you can run your code locally by selecting the Run locally.
Load code from file or URL
In the main menu, go to
or press Ctrl+Alt+Shift+Insert.From the New Scratch File window, select Go.
On the toolbar, click the Load icon ().
In the dialog, select the source of your code: File or URL.
Click OK.
Format code with the Go Playground formatter
Open your code in a scratch file. For more information about scratch files, refer to Scratch files.
To create a new file, select
from the main menu or press Ctrl+Alt+Shift+Insert.On the toolbar, click the Format icon ().
Share code in the Go Playground from scratch files
Open your code in a scratch file. For more information about scratch files, refer to Scratch files.
To create a new file, select
from the main menu or press Ctrl+Alt+Shift+Insert.On the toolbar, click the Format icon ().
Depending on the selected version, GoLand adds a version parameter to the generated link to the Go Playground.
Selecting Go version
Open your code in a scratch file. For more information about scratch files, refer to Scratch files.
To create a new file, select
from the main menu or press Ctrl+Alt+Shift+Insert.From the Go version drop-down, select the version that you want.
Depending on the selected version, GoLand adds a version parameter to the generated link to the Go Playground.
Selecting context of a module
Open your code in a scratch file. For more information about scratch files, refer to Scratch files.
To create a new file, select
from the main menu or press Ctrl+Alt+Shift+Insert.From the Go version drop-down, select the version that you want.