What's New in GoLand

GoLand 2020.1 brings a variety of upgrades for Go Modules support, as well as code-editing features that require little to no interaction from the user and an expanded code completion family.

On top of that, there are new code inspections, quick-fixes, and other improvements, such as the new LightEdit mode, which lets you open a file in the text editor without creating or loading a project, intelligent spelling and grammar checks, and new features for web development and working with databases.

Prefer to learn interactively instead of by reading about it? Complete the Features of GoLand 2020.1 tutorial inside the IDE.

Go Modules Improvements

Configuring GOPROXY with automatically suggested by GoLand choice between 'direct' and 'off' values in the new 'Environment Variables' dialog.

Go 1.13’s environment variables GOPROXY, GOPRIVATE, GOSUMDB, GONOPROXY, and GONOSUMB are now supported.

Configure their default values using the Go Modules projects template. Simply click the Browse icon in the Environment field to open the new Environment Variables dialog.

Code completion for 'replace' keyword, dependency name, and path for the replacement in action

Code completion for go, module, require, replace, exclude keywords, dependencies’ names, and replacements with local paths is available for go.mod file.

GoLand suggest to import package

Rename and Move refactorings are also in business. When you rename or move directories referenced by replace statements, GoLand will change the path in the go.mod file accordingly.

Using Find Usages to find where the directory is used in the go.mod file, and navigate to its source

Now you can also call up Find Usages via the Project View to explore where the path to a particular directory is used in the go.mod file.

GoLand highlights unused and missed dependencies and suggest to remove and fetch them using quick-fixes via Alt-Enter

In GoLand 2020.1 you can fetch missing dependencies and remove unused via Alt-Enter.

GoLand suggest to import package

Last but not least, the new version will show a notification before you commit if there are replacements with local paths, so that you don’t commit them by accident.

Code Completion features you don’t need to learn how to use

GoLand 2020.1 will suggest if err != nil { ... } to complete an error-handling pattern. Just type if inside the expression.

Define struct and interface types faster simply by typing the type keyword or struct and interface.

The Fill Fields action adds spaces after colons when required by the formatting rules. It also adds a comma at the end of the statement in declarations of composite literals.

Now when you are working with maps, code completion moves the cursor to behind the closing bracket after you complete a key type.

For the return type of the function, completion provides suggestions for local variables and zero values that will be appropriate for the corresponding return value type.

Smart Code Completion (⌥⇧Space or Ctrl+Shift+Space)

Smart Code Completion suggests a pointer to struct initializer.

It also suggests compatible types in assertions and type switch cases first.

In type assertion, it offers the type of the assigned variable.

Finally, it provides a list of suggestions for possible pointers in the expression.

Basic Code Completion (⌃Space or Ctrl+Space)

Please welcome Basic Code Completion for comments, which makes writing documentation a lot easier! It suggests names for the current package declarations and parameter names for functions and methods.

Besides that, Basic Code Completion will suggest literals and conversions.

Code Editing

GoLand 2020.1 adds parentheses around return types after the comma when writing a signature of a multi-value return function.

When you paste some text in a string literal, the IDE escapes double-quotes.

To learn more about features that work without you having to do anything, read GoLand Editing Features You Didn’t Know About article.

Go 1.14 support

Support for overlapping interfaces

Go 1.14 has added support for embedding overlapping interfaces, and so have we! When you describe different aspects of a type using overlapping interfaces, GoLand will not report duplicated methods for them as errors.

Automatic vendoring mode

Vendoring mode is enabled automatically in Go 1.14 if the module root contains a vendor directory. For GoLand 2020.1, we’ve decided to implement similar behavior for Go versions 1.13 and earlier. The IDE will automatically resolve imports to the vendor/ folder if it is present in the module.

Debugger updates

Profiler labels support

To help you more easily distinguish between goroutines during debugging or core dump analysis, we’ve added profiler labels to them.

If you’d like to learn more, read this article: How to Find Goroutines During Debugging.

Macros support

Now it’s possible to use macros as parameters to run or debug your application. In the Run/Debug Configurations dialog, click + in the Go Tool or Program arguments fields to open the new Macros dialog with the list of available macros to use.

In addition, you can now store the configuration file in the project. Select the Store as project file option at the top of the Run/Debug Configurations dialog.

Postfix Completion

The .else Postfix Completion template quickly adds an if statement to check if the expression is false.

Quick-fixes

Change a non-formatting call to a formatting one in no time, by pressing Alt+Enter.

The Create variable quick-fix now shows an expected type hint to make it easier to enter the right value.

Code inspections

This new code inspection warns you about invalid calls of pointer methods on non-pointer receivers and offers a quick-fix.

The code inspection Invalid conversions of uintptr to unsafe.Pointer warns you about incorrect uses of uintptr and unsafe.Pointer to convert integers to pointers.

The inspection Unmarshal is called with incorrect argument analyzes calls to json.Unmarshal and similar functions of encoding/json, encoding/xml, and encoding/gob packages.

The Locks mistakenly passed by value code inspection helps you avoid accidentally copying a value that contains a lock.

Live templates

We’ve added new templates to help you quickly create groups of declarations. These include consts, vars, types, and imports. When you use one of these templates, GoLand will add braces around the declaration names.

The fori template inserts the boilerplate code for the classic for-loop.

Refactorings

The Extract Method refactoring keeps the original order of the parent function and method parameters.

The Rename refactoring now detects the renaming of a declaration automatically. This means that when you rename a declaration manually, the IDE will show a gutter icon that will offer to rename all its usages.

Navigation

Navigate to implementations (⌥⌘B on macOS and Ctrl+Alt+B on Windows/Linux) and Navigate to Declaration or Usages (⌘B on macOS and Ctrl+B on Windows/Linux) now show results from the current project first.

Also, the Find Usages (Alt+F7 on Windows/Linux or ⌥F7 on macOS) action now always looks for usages of interface methods by default. To find usages of the current method as before, use Alt+Shift+Ctrl+F7 on Windows/Linux or ⌥⇧⌘F7 on macOS.

VCS Improvements

New Commit tool window

The new commit tool window now incorporates the Local Changes and Shelf tabs. This tool window covers all commit-related tasks, like checking diffs, selecting files and chunks to commit, and entering a commit message. Commit is a vertical tool window located on the left side of the screen, which leaves room for the entire editor to show the diff.

Improved Branches popup

The Branches popup has been reworked in several ways:

  • We’ve added an explicit search field that enables you to look for existing remote and local branches.
  • Now you can use the Refresh button to update the existing remote branches.
  • Incoming (blue) and outgoing (green) commit indicators have been added to the status bar.

Interactively Rebase from Here dialog

We have substantially reworked Interactively Rebase from Here. This is a dialog that allows you to edit, combine, and remove your previous commits in order to make your commit history more linear and comprehensible.

To invoke this dialog, go to the Log tab of the Git tool window, select the oldest commit in the series of commits you want to edit, right-click it, and choose Interactively Rebase from Here.

Databases updates

  • Run script files and code snippets using Run configurations. This allows you to run several files at once, reorder them, add new ones, and run other programs or configurations before launch.
  • Now you can see the results in the code editor. This option is disabled by default. To turn it on, go to Settings/Preferences | Database | General | Show output results in the editor.
  • Create a configuration of the SSH tunnel and use it in many data sources or even in projects.
  • We've added the ability to export data to an Excel file.
  • Also, you can choose your preferred data format in the extractor drop-down.

Web Development

New smart intentions and inspections for JavaScript and TypeScript

Use new smart intentions and inspections (Alt+Enter) to save yourself some time when coding! For example, you can now quickly convert the existing code to optional chaining and/or nullish coalescing, the syntax introduced in the latest versions of JavaScript and TypeScript.

More helpful quick documentation

For JavaScript and TypeScript, the Documentation popup now shows more useful information, including details about the type and visibility of the symbol as well as where that symbol is defined.

More changes

  • JetBrains Mono, a new font from JetBrains, is available by default. To learn more about the font, please visit this page.
  • Grazie, a plugin that provides intelligent spelling and grammar checks for text that you write in the IDE, is bundled by default.
  • The new LightEdit Mode allows you to open a file in the text editor without creating or loading a project. To try this new functionality out, you will first need to create a command-line launcher from Tools | Create Command-line Launcher, as described here (if you’re using the Toolbox App, the steps will be slightly different). For more detailed instructions on how to open a file, compare/merge files, and even run code inspections, see this web help section.
  • We’ve added the new Zen Mode, which gets rid of possible distractions and helps you focus completely on your code. In its essence, this mode combines the Distraction Free Mode and the Full Screen Mode. To enable it, go to View | Appearance | Enter Zen Mod, or choose it from the Quick Switch Scheme popup (Ctrl+` | View mode | Enter Zen Mode).
  • External Documentation now leads to https://pkg.go.dev instead of https://godoc.org.
  • We’ve brought back the Default color scheme, albeit with a new name, Classic Light.