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.
Firstly, you need to create a default Go project with Go modules integrations but be sure to place your project under GOPATH.
Create a Go project
Select
.Alternatively, click New Project in the Welcome to IntelliJ IDEA dialog.
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.
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 (
) 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.
(Optional) Select or clear the Enable vendoring support automatically checkbox to enable or disable vendoring support.
(Optional) In the Environment field, specify any environment variables your project requires. For example,
GOPROXY
.To learn more, refer to the Environment variables section.
Click Create to create the project.
Secondly, disable Go modules integration.
Disable the Go modules integration
Press Ctrl+Alt+S to open settings and then select
.Clear the Enable Go modules integration checkbox.
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.

Enable entire GOPATH indexing
Open settings by pressing Ctrl+Alt+S and navigate to
.Select the Index entire GOPATH checkbox.
Download and install dependencies
Click an unresolved dependency in the
import
statement and press Alt+Enter.Select
go get -t <package>
from the list of intention actions.
Installing Go SDK
Select a local copy of the Go SDK
Press Ctrl+Alt+S to open settings and then select
.Click the Add SDK button (
) and select Local.
In the file browser, navigate to the SDK version that is on your hard drive.
Click Open.
Download the Go SDK
Press Ctrl+Alt+S to open settings and then select
.Click the Add SDK button (
) and select Download.
From the Version list, select the SDK version.
In the Location field, specify the path for the SDK. To use a file browser, click the Browse icon (
).
Click OK.