GoLand 2020.2 Help

Create a new project

If you plan to work on a project that does not require complex dependency management, consider creating the Go project (File | New | Project). Otherwise, create the Go modules project or enable Go modules in your current project.

Without Go modules, you need to store your source code under the GOPATH directory (a Go workspace). Also, you cannot install multiple versions of the same dependency package since the go get command downloads the dependency package to the same directory.

Create a Go project

  1. Select File | New | Project.

  2. In the New Project page, select Go.

  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. For more information about installing Go SDK, see Installing Go SDK.

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

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

    • Checkbox selected: packages from GOPATH and project files are indexed.

  6. Click Create.

    Create a project with Go integration

Installing Go SDK

Select a local copy of the Go SDK

Ensure that the provided path to the folder with Go SDK includes bin and src folders.

  1. In the New Project dialog, select Go.

  2. Click 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.

    Select a local copy of Go SDK

Download the Go SDK

  1. In the New Project dialog, select Go.

  2. Click the Add SDK button 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.

    Download the Go SDK

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.

Enable entire GOPATH indexing

  1. Open settings by pressing Ctrl+Alt+S and navigate to GOPATH.

  2. Select the Index entire GOPATH checkbox.

    Index entire GOPATH

Download and install dependencies

  1. Click an unresolved dependency in the import section and press Alt+Enter.

  2. Select go get -t <package>.

    Add and install dependencies

Project types

Project typeDescription
Go modulesA project with Go modules dependency management.
DepA project with dep dependency management. The dep tool was initially developed to experiment with dependency management system for Go. From Go 1.11, the Go project has officially adopted a different approach, based on the concept of Go modules.
App EngineA project with Google App Engine integration. With App Engine integration, you can run and debug Google App Engine applications. For more information about App Engine, see App Engine at cloud.google.com.
HTML5 BoilerplateA project with integration with the HTML5 Boilerplate framework. For more information about HTML5 Biolerplate, see documentation at html5boilerplate.com.
React appA project with React integration. For more information about React, see documentation at reactjs.org.
BootstrapA project with Bootstrap integration. Read more about Bootstrap at https://getbootstrap.com.
React NativeA project with React integration. React Native is an open-source mobile application framework. For more information about React Native, see documentation at reactnative.dev.
WebAssembly (Wasm)A project with WebAssembly integration. WebAssembly (Wasm) is a binary code that you can run in a browser. GoLand supports generation of WASM files from GO files. You can read more about WebAssembly in WebAssembly documentation at webassembly.org.
Last modified: 03 November 2020