GoLand 2023.3 Help

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.

Create a Go (GOPATH) project

  1. Click File | New | Project. Alternatively, on the Welcome screen, click New Project.

  2. In the New Project dialog, select Go (GOPATH).

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

  4. 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.

  5. (Optional) Toggle the Index entire GOPATH checkbox:

    • When cleared, project files and vendored packages are indexed. Packages from GOPATH are not indexed. Might improve the overall performance.

    • When selected, packages from GOPATH and project files are indexed.

  6. Click Create.

    Create a project with Go (GOPATH) 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 Control+Alt+S and navigate to 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 Control+Alt+S to open the IDE settings and then select Go | GOROOT.

  2. Click the AddSDK({0}) 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 Control+Alt+S to open the IDE settings and then select Go | GOROOT.

  2. Click the AddSDK({0}) 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: 10 January 2024