Getting Started with Gogland
Setting up a workspace
It's recommended to keep all Go code in single a workspace with the following layout:
Also make sure the environment variable GOPATH is defined and points out to the workspace location. This variable will be used by Go commands and the IDE to resolve import statements, install, build and update packages, etc.
Setting up a project from existing sources
To import an existing project, click Open in the Welcome screen and select the project directory (preferably inside the workspace, see earlier).
After the project is opened, go to and select a Go distribution. If none available, make sure to download a copy, and then select it.
After the SDK is set, please wait until the IDE has indexed the workspace. This may take awhile but will pay off later with instant coding assistance.
Changing the Go SDK (GOROOT)
The Go SDK configuration process is the same if you use the Go AppEngine SDK.
Setting up a project from scratch
To create a blank project, click Create New Project in the Welcome screen and choose Go as your project type in the Project Wizard, then select a project SDK (or configure a new one as described above) by clicking Configure.
You’ll be prompted to choose a project name and directory (preferably inside the workspace, as described earlier ), and a Go SDK (GOROOT).
Changing the GOPATH settings
To run a Go application or tests written in Go, you'll need a Run Configuration. To define it, use the main menu . In the Run/Debug Configuration dialog (that shows up after you click Edit Configurations), click the Plus button and choose the type of Run Configuration that you need:
- The Go Application type is equal to go build command.
- The Go Single File type is equal to go run.
- The Go Test type is equal to go test. Make sure to select the test framework your tests use: gotest, gocheck or gobench.
- The Go App Engine type lets you deploy your application to Google AppEngine. Note, it requires your Go module to use a Go AppEngine SDK.
After your Run Configuration is configured, you can run it any time via the main menu Run → Run (or Debug if it's what you need).
Using coding assistance
- Basic code completion:Ctrl+Space.
- Statement completion:Ctrl+Shift+Enter).
- See parameters for a method or constructor:Ctrl+P.
- Browse documentation for a symbol at the caret:Ctrl+Q.
- Navigate to the declaration of a symbol at the caret:Ctrl+B.
- Navigate to the declaration of any symbol: hold Ctrl (Cmd for macOS) and click the left mouse button on that symbol.
- View current file structure:Ctrl+F12. In that popup you can select a memmber and press Enter to navigate to it within the file.
- Rename a symbol at the caret:Shift+F6. Press twice to see the Rename dialog with more options.
- Usually your code is being formatted automatically as you type. To re-format it manually, use or . Note that the Go fmt option is also available in the Commit Changes dialog as a Before Commit action.
- See a popup with usages of a symbol at the caret:Ctrl+Alt+F7. To see usages in a tool window, press Alt+F7. For more options, pressCtrl+Shift+Alt+F7.
- Expand a live template: type its abbreviation in the Editor and press Tab. To see the list of all available live templates and to define your own, go to and find the Go group.
- Debugger actions: Step Over viaF8, Step Into viaF7, Evaluate Expression via Alt+F8 and Toggle Breakpoint viaCtrl+F8.
We also recommend you to read the Discover IntelliJ IDEA document to better know how IntelliJ-based IDE work.
To better know how the IntelliJ platform works, we recommend you to read the Discover IntelliJ IDEA document.
Sending your feedback
Your feedback is welcome in the Gogland issue tracker at https://youtrack.jetbrains.com/issues/GO