GoLand 2025.1 Help

Configuring golangci-lint

GoLand provides functionality to work with golangci-lint. You can configure it to analyze and improve your Go code by enabling or disabling specific linters. In the terminology of GoLand, linters are inspections that detect problematic code in your project before you run it.

With GoLand, you can also use your golangci-lint configuration files to check your code in your CI pipeline and run the same linters in the IDE.

Configuring golangci-lint

Set the executable path for golangci-lint

  1. Press Ctrl+Alt+S to open settings and then select Go | Linters.

  2. From the Executable list, select the path to the golangci-lint executable.

    If the path is not detected automatically, click the plus icon and choose one of the following options:

    • Browse: use the file browser to select the path to the golangci-lint executable.

    • Download: download and install the golangci-lint executable to a directory accessible to your user.

    Set the executable path for golangci-lint

Set the number of concurrent processes

  1. Press Ctrl+Alt+S to open settings and then select Go | Linters.

  2. In the Concurrency field, enter the number of operating system threads (GOMAXPROCS) that can execute golangci-lint simultaneously.

Enable or disable specific linters

  1. Press Ctrl+Alt+S to open settings and then select Go | Linters.

  2. Review the list of linters in the table.

  3. Select the checkbox next to a linter to enable it, or clear the checkbox to disable it.

Use a custom configuration file for golangci-lint

  1. Press Ctrl+Alt+S to open settings and then select Go | Linters.

  2. Select the Use config checkbox.

  3. Specify the path to your custom configuration file in the input field.

    When a configuration file is selected, the table fields become disabled. The IDE will use the settings and linters defined in the configuration file.

    To edit the configuration file in the editor, click Edit. The configuration file is opened in the editor.

    Use a custom configuration file for golangci-lint

Adjust severity levels for linters

  1. Press Ctrl+Alt+S to open settings and then select Go | Linters.

  2. Click Configure severity to open the Inspections settings page, where you can adjust the severity levels for golangci-lint checks.

    For more information about severity levels, refer to Change inspection severity.

    Adjust severity levels for linters

Using results of golangci-lint in the editor

The results of golangci-lint linters are highlighted in the editor based on the configured severity levels.

Linters are highlighted in the editor

To view the results of golangci-lint linters, click the Problems widget. The detected issues will appear in the Problems tool window.

Using results of golangci-lint in the editor

Running golangci-lint in the terminal

  1. From the main menu, select View | Tool Windows | Terminal.

  2. In the Terminal tool window, type:

    golangci-lint run
    Running golangci-lint in the terminal
Last modified: 12 February 2025
OSZAR »