GoLand 2019.3 consumes less CPU and performs faster, boosts its Go Modules support, adds a set of new quick-fixes, and enhances the refactorings. It’s possible to call a method of an embedded field via Evaluate Expression and debug your applications remotely using Mozilla rr.

You can also enable a Global File Watcher for every new project, work with MongoDB, and more!

Performance

A chart with the startup times measurement of GoLand 2019.3 on different operating systems

Since releasing GoLand 2019.2 this summer, we’ve been working hard to make GoLand perform faster and consume less CPU. One of the major performance improvements is reducing the startup times, when the IDE prepares everything under the hood, displays the welcome screen, and indexes a project.

Please note that results may vary depending on the size of your project and your device’s age, RAM, and disk space. We will keep working on this, so you can expect even faster startup times in future releases.

Go Modules improvements

Navigation from go.mod file to the Project View

GoLand 2019.3 provides syntax highlighting and navigation for go.mod files. Press ⌘+B on macOS or Ctrl+B on Windows/Linux on a specific dependency import path, and GoLand will navigate you to its sources in the Project View.

Also, in the Project View, the Go Modules will be displayed with their full import path instead of just the last segment of it. The version of each Go Module will also be shown in a more muted font color than the import path, to help you easily distinguish between them.

Debugger updates

Evaluate Expression dialog with the result of call

Call Method of an Embedded Field

Evaluate Expression in the debugger now lets you call a method of an embedded field directly.

Debugging with Mozilla rr

Remote debugging with Mozilla rr

Many production services written in Go run on Linux and Mozilla rr can help investigate bugs that are difficult to reproduce. Mozilla rr debugging is supported starting from GoLand 2018.3, but it used to work only on developer machines running Linux. Now, it is possible to start a debug server on a Linux machine and to debug the trace remotely from macOS and Windows. Follow these steps:

  • Collect an rr trace on the remote machine.
  • Start the debugger on the remote machine like this: dlv --headless --api-version 2 -l localhost:2345 replay /path/to/trace/dir /path/to/binary.
  • Connect to the remote machine via the Go Remote configuration.

Please note Mozilla rr is available only on Linux machines.

New quick-fixes

Delete unused parameter name from the expression via Alt+Enter

Handling unused parameters

For an unused parameter, GoLand now highlights its name and type if both can be removed, or only the name if the type is used for implementing a method specification.

In the latter case, the IDE provides two quick-fixes for you to choose from: Delete parameter names or Rename to_. The same behavior is provided for functions that are used as a function type

Also, now it’s possible to remove all the unused parameters in one go. Press Alt+Enter and use the Delete all unused parameters quick-fix.

Create a missing function

Create missing method or function

GoLand provides a quick-fix to create a missing function or method when it's used in a function type. Just press Alt+Enter and choose Create method/function.

GoLand suggest to import package

Enhanced handling of package aliases

GoLand now suggests importing packages based on their used aliases via Alt+Enter in any file in your project.

Refactorings

Types of parameters are shown in the Parameters and Result Parameters tabs

Change Signature

Change Signature now always shows the type of parameters in the Parameters and Result parameters tabs. Tick the new Reuse types checkbox to collapse consequence types in the Signature Preview and the result.

In addition, you will find two new intention actions, Reuse signature types which merges parameter definitions in a single declaration, and Expand signature types which adds types to each parameter via Alt+Enter.

Extract Variable suggests err for expression of type error

Extract Variable & Rename

Extract Variable and Rename are now better at suggesting names. For example, err is suggested for expressions of type error, ctx is suggested for context.Context, and so on.

Improved behavior of Code Inspections

Comparison of code inspections behavior between 2019.2 and 2019.3 versions

GoLand’s code inspections are more focused now. We've reduced the highlighting range of the detected issues in the code editor, to help show the most relevant quick-fixes and intention actions for a particular piece of code when you invoke the context menu via Alt+Enter.

Code Editing

An example of the error message for rune literal

Improved rune literal lexer

We’ve improved the rune literal lexer in several ways:

  • GoLand provides a clearer and more concise error message explaining why the expression is incorrect.
  • GoLand doesn’t highlight a valid rune literal as an error after editing.
  • Parsing of invalid rune literals is more stable.
GoLand highlights reassignment in the left-hand side of declaration

Highlighting for reassignments

Go allows using existing variables on the left-hand side of short var declarations. Thus, two constructs that look the same can have different meanings. To make this easier to spot, we’ve added syntax highlighting for such reassignments.

An example of code folding for composite literals

Code folding for composite literals

GoLand 2019.3 provides code folding for composite literals. Use the code folding toggles to fold or expand the code fragment, or press Ctrl+NumPad Minus/Ctrl+NumPad Plus on Windows or ⌘+NumPad Minus/⌘+NumPad Plus on macOS. To configure the default code folding behavior, go to Settings/Preferences | Editor | General | Code Folding.

Live templates enhanced

forr live template suggests line as a value

The live templates for and forr now suggest relevant variable names. For example, names like i and index are suggested for an index; s, string, and line are suggested for a value.

The live template meth now provides code suggestions for receiver names.

Navigation

Search only in the selected area

Search only in a selected area

Search only in a selected area when using Find (⌘+F on macOS and Ctrl+F on Windows/Linux). Simply select the piece of code you need in the editor and invoke Find – the IDE will then perform the search only in the selected area. To easily switch to searching within the whole file, press ⌘+F/ Ctrl+F a second time, or toggle the In Selection option in the bar.

Searching with ‘Find in Path’ with a file mask option in action

Using ‘Find in Path’ with a file mask option

Now, when you search in the Find in Path dialog using a file mask, GoLand shows the file extensions in the search results accordingly. This makes it easier for you to distinguish between files with the same name but with different file extensions.

Enable Global File Watcher for all new projects

Enabling golangci-lint for all new projects

In GoLand 2018.2, we added an option to share a file watcher configuration among different projects using the options Project and Global – it’s called a Global File Watcher.

However, you would have still needed to enable this watcher in each new project. Now, it’s possible to enable this watcher by default in all new projects you create or open.

In the menu File, select Other Settings | Settings for new projects, then go to Tools | File Watchers, add a new global watcher, and then select the checkbox next to it to enable it in all new projects.

Tutorials

An exercise for the new feature of Extract Variable refactoring

Often there’s not enough time to read the What’s New pages, release notes, and blog posts about the product you use, while you need to finish your project and meet the deadline. That’s why we’ve added Tutorials for you to learn about GoLand features when you are ready.

You can find Tutorials on the welcome screen, above your project list. When you upgrade the IDE to a new version, there will be a lesson covering the features from the new release. Alternatively, you can access Tutorials via a corresponding tool window from any project.

More changes

Switching between the callers and callees in the Hierarchy tool window

Hierarchy tool window

There is a new option to analyze the callees’ method hierarchy in the Hierarchy tool window. We’ve added two dedicated buttons that let you switch between the callers and callees of the selected method. Also, now you can sort the elements within a tree alphabetically, by clicking a special button in the menu. To see the Hierarchy tool window in the Tool Windows list, you need to build a hierarchy first and then go to Navigate | Call Hierarchy or Navigate | Type Hierarchy.

Switching theme plugin without restarting the IDE

Switch theme and keymap plugins on the fly

In GoLand 2019.3, you can install and uninstall any theme plugins and keymap plugins without restarting the IDE.

Select ‘Add Keyboard Shortcut’ in the settings for ‘Focus Editor’ action

A custom shortcut for returning the focus to the editor

Set your custom shortcut for the action that takes the focus back to the editor, instead of using ESC. Find the Focus Editor action in references/Settings | Keymap, right-click it, and select Add Keyboard Shortcut from the drop-down.

More visible scrollbars in the editor

More visible scrollbars

We've added an option to make the scrollbars more visible. To do this, select the Use contrast scrollbars checkbox in Preferences/Settings | Appearance & Behavior | Appearance.

Version control improvements

New Clone dialog with the list of repositories

Reworked Clone dialog

The Clone dialog is located under VCS | Get from Version control. Now you can log in from this dialog, or, if you’re already logged in, the IDE will instantly preview the lists of all repositories grouped by accounts or organizations.

‘Show Details’ opens a window with conflict changes

More insight into merge conflicts

Now it is easier to investigate a conflict during a merge, rebase, or cherry-pick operation. Simply click the Show Details link to get the list of commits that led to the resulting code state, and get more information about the source of the changes displayed in the Merge dialog.

Databases updates

View collections and fields in the database explorer

MongoDB support

GoLand 2019.3 provides basic support for MongoDB. Now you can:

  • View collections and fields in the database explorer.
  • Open any collection or observe the query result. It’s also possible to sort by columns or filter the values.
  • Run queries and get the results. Select a statement and run it by pressing Ctrl/⌘+Enter or by using the Play button on the toolbar.
An example of the connection error

Search for connection error

It’s now easier to explore connection errors. When a connection fails, you can just click the dedicated button in the IDE to move to the search results for your error using the Google search engine.

Web development

Code completion for the class name from CSS library

Completion for CSS libraries on CDN

If you’re using Bootstrap or another CSS library and have it linked from a CDN in your HTML file, you can now get completion for the class names from that library, without adding its sources to the project.

Code suggestions for new variable

Name suggestions for new symbols

When adding new variable and parameter names in JavaScript or TypeScript, you’ll now get name suggestions based on the names of classes, interfaces, and type aliases defined in the project, standard libraries, and dependencies you’re using.

For new variables, functions, classes, and interfaces, you’ll also get suggestions for names that were already used in the same scope but haven’t been defined yet.