GoLand 2022.1 Help

Dep

Create a project with dep integration

Create a new project with Dep integration

  1. Install the dep distribution.

  2. Select File | New | Project….

    Alternatively, click New Project in the Welcome to GoLand dialog.

  3. In the New Project dialog, select Dep.

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

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

  6. From the Dep Executable list, select a path to the dep executable. To select a path to the dep executable manually, click the Browse button ( the Browse button) and navigate to the folder with the dep executable.

  7. Click Create.

    Create a project with Dep integration

Enable dep integration for projects with Go modules integration

  1. Install the dep distribution.

  2. Press Ctrl+Alt+S to open the IDE settings and select Go | Go Modules.

  3. Clear the Enable Go modules integration checkbox.

    Enable Go modules integration
  4. Navigate to Go | Dep

  5. Select the Enable dep integration checkbox.

  6. From the Dep Executable list, select a path to the dep executable. To select a path to the dep executable manually, click the Browse button ( the Browse button) and navigate to the folder with the dep executable.

  7. Click OK.

    Dep Executable

Working with dependencies

Ensure that you create your Dep project under $GOPATH/src. The GOPATH variable points to a root directory that contains bin, pkg, and src subdirectories. The project source is under src. Tools like godep and go install operate on the project source, not on the entire GOPATH. For more details about the dep project, see the Go Workspace documentation.

If you want to use any location for the project source, consider using Go modules integration.

Import dependencies

  1. Click the dependency declaration.

  2. Press Alt+Enter and select dep ensure.

    Import dependencies

Installing Go SDK

Select a local copy of the Go SDK

  1. Press Ctrl+Alt+S to open the IDE settings and 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 Ctrl+Alt+S to open the IDE settings and 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: 17 May 2022