Running
You can run applications right from GoLand if you have an GOROOT set up for your project.
If you are not going to pass any parameters to your program, and your program does not require any specific actions to be performed before start, you can run it right from the editor.
note
The class that you are going to execute must contain a
main()
method with a valid signature, for example:public static void main(String[] args)
.
Click
in the gutter near the class declaration and select Run.
To run a script, open it in the editor or select it in the Project tool window, and then select Run <script file name> from the context menu.
Click
in the gutter near the class declaration and select Modify Run Configuration.
Modify the run/debug configuration as needed. For example, if you need to run your program with arguments, add the arguments to the Program arguments field.
tip
To quickly access the fields only using a keyboard, hold Alt and use the shortcut according to the hints that appear.
When the application starts, you can view its output and interact with it in the Run tool window. Every run/debug configuration creates a separate tab when you run it.

tip
Use the Ctrl0F shortcut to search for text occurrences in the console output.
To learn more about tool windows and how to manage them, see the Tool windows topic.
The fields that appear in the right-hand pane display the default settings for the selected configuration type.
Name | Description |
---|---|
Run kind | A building scope for your application. File and Package scopes work similarly in tests and compilation/running configurations (in terms of the scope they cover).
|
Package path | A full import path of the package that you want to compile (for example, You can press CtrlSpace to see a list of available packages. ![]() |
Output directory | A directory for the executable file. |
Run after build | Execute the application after the build. |
Working directory | Directory that is used for the built application. If you have any code that creates relative files or directories, they will be relative to this directory. |
Environment | Environment variables for your application. To edit environment variables, click the Browse button at the end of the field. In the Environment Variables dialog, click the Add button and add the environment variables that you need. ![]() |
Go tool arguments | Arguments for the go tool (for example, |
Use all custom build tags | All tags that are applied during the build. Tags are listed in settings CtrlAlt0S under Go | Build Tags. |
Program arguments | Arguments for the built application. Also, you can use macros in this field. |
Run with sudo | Grant sudo privileges for the application. |
Module | Name of the current module. |
Before launch | Add tasks that you want to launch before the launch of the selected run/debug configuration. To add a task click the Add button AltInsert and select the tool that you want to add. |
Store as project file | Enable this option to save your configuration as a project file and share it with team members through VCS. |
On the toolbar of the Run tool window, click
or press ShiftF10.
tip
If you re-run an application, the output of the previous run is lost. To preserve the output of an application, click the Pin Tab button on the toolbar of the Run tool window. When a tab is pinned, new sessions are opened in another tab.
When you stop a program, its process is interrupted and exits immediately. When you pause a program, it continues running in the background, but its output is suspended.
In the Run tool window, click
on the toolbar. Alternatively, press CtrlF2 and select the process to stop.
Right-click in the Run tool window and select Pause Output from the context menu. Use the same toggle to resume the program.
note
Only the output is suspended. Pausing the output does not affect the execution of the program.
You can view the list of all active run or debug sessions and navigate between them.
From the main menu, select Run | Show Running List. In the top-right corner of the editor, GoLand shows a list with all active applications.
When you run, debug, or test your code, GoLand creates a temporary run/debug configuration. This configuration includes all the details of how you want to perform the operation. Usually, a temporary configuration is enough to run or debug your code. You can use the temporary configuration to run your application one time, or save it for future use.
Depending on your purposes, you can edit existing or create new configurations. For more information about editing you configurations, see Run/debug configurations.
note
If the options that launch tools before running were enabled in a Run/Debug configuration, GoLand runs the tools, and after success will run the application. Otherwise, the program will start immediately.
Thanks for your feedback!