IntelliJ IDEA 2022.3 Help


You might want to create this type of a project if you do not need a complex dependency management and ready to store all the project files under GOPATH.

Create a GOPATH project

By default, IntelliJ IDEA creates a project with Go modules integration. You can disable this option in settings. But ensure that you keep the necessary file structure and store your project under GOPATH. For more information about storing your code under GOPATH, see How to Write Go Code (with GOPATH) at

Firstly, you need to create a default Go project with Go modules integrations but be sure to place your project under GOPATH.

Create a project with Go integration

  1. Select File | New | New Project.

    Alternatively, click New Project in the Welcome to IntelliJ IDEA dialog.

  2. In the Name field, type a name of your project.

  3. In the Location field, specify the path where you want to store your project.

  4. If you want to initiate a git repository for the project, select the Create Git repository checkbox.

  5. In the Language list, click the Install Plugin icon (the Install Plugin button), and select Go. If you have already installed the Go plugin, select it from the Language list.

  6. If the Go plugin is not installed, in the Plugins dialog, find the Go plugin and click Install.

  7. Click OK to close the Plugins dialog.

  8. In the New Project dialog, select New Project from the list of available projects.

    Ensure that Go is selected as a project language in the Language list.

  9. In the GOROOT field, specify the location of your Go installation. Usually, the location is defined automatically.

    To change or install a new version of Go SDK, click the Add SDK… button and select Local… to choose the Go SDK version on your hard drive, or select Download… to download Go SDK from the official repository.

  10. (Optional) Select or clear the Enable vendoring support automatically checkbox.

  11. (Optional) In the Environment field, specify environment variables that you need for your project. For example, the GOPROXY environment variable. Read more about environment variables in the Environment variables section.

  12. Click Create.

    Download Go SDK

Secondly, disable Go modules integration.

Disable the Go modules integration

  1. Press Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | Go | Go Modules.

  2. Clear the Enable Go modules integration checkbox.

    Enable Go modules integration

Add and install dependencies

GOPATH stores your code base and all the files that are necessary for your development. Also, it includes packages that you download and install. When disabled, only project and vendored packages are indexed. It might improve the overall performance but makes it impossible to use packages from GOPATH.

If your project has external dependencies, you might want to enable entire GOPATH indexing. By default, indexing of entire GOPATH is disabled.

Disable Go modules in a project

Enable entire GOPATH indexing

  1. Open settings by pressing Ctrl+Alt+S and navigate to Languages & Frameworks | Go | GOPATH.

  2. Select the Index entire GOPATH checkbox.

Download and install dependencies

  1. Click an unresolved dependency in the import section and press Alt+Enter.

  2. Select go get -t <package>.

Installing Go SDK

Select a local copy of the Go SDK

  1. Press Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | Go | GOROOT.

  2. Click the Add SDK button (the Add SDK button) and select Local….

  3. In the file browser, navigate to the SDK version that is on your hard drive.

  4. Click Open.

    Installing Go SDK

Download the Go SDK

  1. Press Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | Go | GOROOT.

  2. Click the Add SDK button (the Add SDK button) and select Download….

  3. From the Version list, select the SDK version.

  4. In the Location field, specify the path for the SDK. To use a file browser, click the Browse icon (the Browse icon).

  5. Click OK.

    Installing Go SDK
Last modified: 01 December 2022