# Go (GOPATH)

You might want to create this type of project if you do not need complex dependency management and are ready to store all 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, refer to [How to Write Go Code (with GOPATH) at go.dev](https://go.dev/doc/gopath_code).

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

Procedure: Create a Go project

1. Select `File | New | {0, choice, 0#New |1#}{1, choice, 0#Java |1#}Project…`.

Alternatively, navigate to New | Project on the Welcome to IntelliJ IDEA dialog.

2. In the New Project dialog, select New Project from the list of available project types.

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

3. In the GOROOT field, specify the location of your Go installation. IntelliJ IDEA usually detects this location automatically.

To change or install a new Go SDK version, click Add SDK (![Add SDK icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.add.svg)) and choose one of the following options:

* Local: to use an existing SDK from your local system.

* Download: to download a Go SDK version from the official repository.

4. (Optional) Select or clear the Enable vendoring support automatically checkbox to enable or disable vendoring support.

5. (Optional) In the Environment field, specify any environment variables your project requires. For example, `GOPROXY`.

To learn more, refer to the [Environment variables section](create-a-project-with-go-modules-integration.html#environment-variables).

> **Note:**
> Do not use this field to set tags for the `GOEXPERIMENT` variable. Instead, use the Experiments field in the Build Tags settings. For details, see [Using Go experiments](configuring-build-constraints-and-vendoring.html#using_go_experiments).

6. Click Create to create the project.

![Download Go SDK](https://resources.jetbrains.com.cn/help/img/idea/2026.2/go_ij_create_go_modules_project.png)

Secondly, disable Go modules integration.

Procedure: Disable the Go modules integration

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | Go Go Modules`.

2. Clear the Enable Go modules integration checkbox.

![Enable Go modules integration](https://resources.jetbrains.com.cn/help/img/idea/2026.2/go_enable_go_modules_integration.png)

## Add and install dependencies

`GOPATH` stores your codebase and all the files required for development. It also includes any packages that you download and install. When GOPATH indexing is disabled, only project files and vendored packages are indexed. This may improve performance but prevents you from using packages located in GOPATH.

If your project has external dependencies, consider enabling indexing for the entire GOPATH. By default, this option is disabled.

![Disable Go modules in a project](https://resources.jetbrains.com.cn/help/img/idea/2026.2/go_disable_go_modules_in_a_project.png)

Procedure: Enable entire GOPATH indexing

1. Open settings by pressing `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) and navigate to `Languages & Frameworks | Go GOPATH`.

2. Select the Index entire GOPATH checkbox.

Procedure: Download and install dependencies

1. Click an unresolved dependency in the `import` statement and press `Alt+Enter` (Windows), `⌥ ⏎` (macOS), `⌥ ⏎` (IntelliJ IDEA Classic (macOS)), `⌥ ⏎` (macOS System Shortcuts), `Alt+Enter` (XWin), `Alt+Enter` (GNOME), `Alt+Enter` (KDE), `Alt+Enter` (Emacs), `Alt+Enter` (Sublime Text), `⌥ ⏎` (Sublime Text (macOS)), `Alt+Enter` (NetBeans), `Alt+Enter` (Visual Studio), `⌥ ⏎` (Visual Studio (macOS)), `Ctrl+1` (Eclipse), `⌘ 1` (Eclipse (macOS)).

2. Select `go get -t <package>` from the list of intention actions.

![Download and install dependencies](https://resources.jetbrains.com.cn/help/img/idea/2026.2/go_download_and_install_dependencies.png)

## Installing Go SDK

> **Note:**
> Ensure that the provided path to the folder with Go SDK includes `bin` and `src` folders.

Procedure: Select a local copy of the Go SDK

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | Go | GOROOT`.

2. Click the Add SDK button (![the Add SDK button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg)) 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/go_ij_installing_go_sdk.png)

Procedure: Download the Go SDK

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Languages & Frameworks | Go | GOROOT`.

2. Click the Add SDK button (![the Add SDK button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.add.svg)) 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](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.menu-open_dark.svg)).

5. Click OK.

![Installing Go SDK](https://resources.jetbrains.com.cn/help/img/idea/2026.2/go_ij_downloading_go_sdk.png)

