Dep
Last modified: 12 December 2022note
Dep is deprecated in favor of Go modules. Since Go 1.11, consider using Go modules. For more information, see Getting started at golang.github.io
Create a project with dep integration
Create a new project with Dep integration
Install the dep distribution.
Select File | New | Project….
Alternatively, click New Project in the Welcome to GoLand dialog.
In the New Project dialog, select Dep.
In the Location field, specify the path where you want to store your project.
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.
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 (
) and navigate to the folder with the dep executable.
Click Create.
Enable dep integration for projects with Go modules integration
Install the dep distribution.
Press Ctrl+Alt+S to open the IDE settings and select Go | Go Modules.
Clear the Enable Go modules integration checkbox.
Navigate to Go | Dep
Select the Enable dep integration checkbox.
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 (
) and navigate to the folder with the dep executable.
Click OK.
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
Click the dependency declaration.
Press Alt+Enter and select dep ensure.
tip
To see the added dependency, navigate to the vendor directory in the Project tool window.
Installing Go SDK
note
Ensure that the provided path to the folder with Go SDK includes bin and src folders.
Select a local copy of the Go SDK
Press Ctrl+Alt+S to open the IDE settings and select Go | GOROOT.
Click the AddSDK({0}) 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 the IDE settings and select Go | GOROOT.
Click the AddSDK({0}) 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!