Go (GOPATH)
You might want to create this type of a project if you do not need complex dependency management and ready to store all the project files under GOPATH.
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.
Select File | New | New Project.
Alternatively, click New Project in the Welcome to IntelliJ IDEA dialog.
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.
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.
(Optional) Select or clear the Enable vendoring support automatically checkbox.
(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.Click Create.
Secondly, disable Go modules integration.
Press CtrlAlt0S to open the IDE settings and then select Languages & Frameworks | Go | Go Modules.
Clear the Enable Go modules integration checkbox.
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.

Open settings by pressing CtrlAlt0S and navigate to Languages & Frameworks | Go | GOPATH.
Select the Index entire GOPATH checkbox.
Click an unresolved dependency in the
import
section and press AltEnter.Select
go get -t <package>
.
note
Ensure that the provided path to the folder with Go SDK includes bin and src folders.
Press CtrlAlt0S to open the IDE settings and then select Languages & Frameworks | Go | GOROOT.
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.
Press CtrlAlt0S to open the IDE settings and then select Languages & Frameworks | Go | GOROOT.
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.
Thanks for your feedback!