GoLand 2022.3 Help

Release notes

This section lists functionality added to GoLand in the current release. To view release notes for other GoLand versions, click the version switcher on the help site and select the version that you need.

Release notes

Settings: Go environment variables displayed in the settings

GoLand now automatically picks up system variables related to Go modules and displays them in the Environment variables dialog window. To open this window, open settings by pressing Ctrl+Alt+S and navigate to Go | Go Modules. Click the Edit environment variables icon.

From this window, you can edit the values to override them. As before, you can add additional variables in the User environment variables section.

Intention actions: auto-generated protobuf fields ignored for Fill all fields

The IDE ignores auto-generated protocol buffer fields that start with XXX_ when you invoke the Fill all fields intention action. These fields are shown only after you invoke completion for a second time.

auto-generated protobuf fields ignored

Documentation: package names are always shown in Quick documentation

The IDE now always shows package names in the Quick documentation popup for top-level declarations. Before, package headers were shown only when doc.go or <pkg_name>.go files were found.

This feature will help in cases when, for instance, you have multiple types with identical names, as it will allow you to quickly see where a particular type was declared.

package names are always shown in Quick documentation

Editor: inlay hints for constant definitions

GoLand now shows inlay hints for constant definition blocks. This should be particularly useful in iota-derived constant blocks, where the hints show the iota values associated with each position.

To disable inlay hints for constant definitions, open settings by pressing Ctrl+Alt+S and navigate to Preferences | Editor | Inlay Hints. In the tree of categories expand the Values node and clear the Go checkbox.

inlay hints for constant definitions

Go support: the Go workspace file action

To create a workspace file, right-click a parent directory of the project and select Merge multiple 'use' directives into one.

Merge several use directives into one directive

Running: the Go playground inside GoLand

Select and right-click a piece of code, navigate to Open | Playground. This will open a scratch file with a toolbar that contains the same options that you see in the Go playground.

You can format and share your code, change the Go version, run your code by using the Go playground server, or run it locally.

the Go playground inside GoLand

Performance improvements: behavior of 'go list'

When you open a project, GoLand indexes the files and runs the go list command, which reports information about the project structure, for example, which dependencies and modules the project contains. Indexing is paused while go list is running, and you do not have access to code insight features until indexing is finished.

Previously, the go list command would run twice in some cases. This happened because, after the first run, GoLand would recognize that the project had changed without being able to tell whether there were any new modules. A second go list run was then needed to identify whether there were new modules in the project that should be checked.

Now the IDE discovers whether new modules have appeared in the project immediately after the first time go list is run. From now on, go list will only be launched a second time if new modules are detected in the project.

Performance improvements: restore project structure from cache on open

Now, when you open a project, the information reported by go list is saved on disk in cache memory. When you open that project again, the data about the project’s structure is loaded from memory and considered when indexing starts.

Thanks to this, indexing continues without pauses and finishes faster. go list still needs to be launched, but it runs in the background. As a result of these changes, the code insight features are available much faster after you open the project.

Performance improvements: faster IDE startup and project opening

GoLand has received a number of other performance improvements designed to decrease the time it takes to launch applications and open projects.

Some of the processes that used to run sequentially have been parallelized.

Nearly all project components in bundled plugins have been eliminated. As a result, overall startup performance – including editor restoration – has been improved by around 30%.

Quick-fix: the invalid recursive type

If your type contains itself, you will get an Invalid recursive type error. To avoid this, you should include a pointer to a type, not a type itself. To fix this error, press Alt+Enter and select Replace field 'field_name' type with pointer.

Quick-fix: the invalid recursive type

User Interface: new settings sync solution

The new Settings Sync plugin is capable of syncing all shareable settings from the platform, bundled plugins, and third-party plugins. By default, the plugins themselves will be synchronized and installed silently. As for the third-party plugin settings, not all of them will be transferred seamlessly, as this is dependent on the third-party vendors.

The settings are stored in the cloud attached to your JetBrains Account. If you use different IntelliJ-based IDEs associated with the same user account, your settings will be automatically synced.

In the cases where a conflict arises due to the simultaneous modification of settings on two different computers, the settings will be merged using the most recent configuration.

new settings sync solution

Generate: tests for generic functions

You can now generate tests for functions with generic parameters.

tests for generic functions

Quick-fixes: capitalize type parameters

GoLand has an inspection that detects lowercase type parameters and a quick-fix to make them uppercase.

Inlay hints: code vision

Code vision allows you to focus on your code while getting additional information about it. For example, GoLand displays the code authors if version control integration is enabled. If you click a code author’s name, the Annotate with Git blame sidebar opens, letting you see who introduced what changes.

Inlay hints: code vision

Generating code: generate go.work using 'replace' directives

You can now generate go.work from go.mod if you have replace directives there. Place the caret on a replace directive, press Alt+Enter to see all available intention actions, and select the Generate 'go.work' using 'replace' directives quick-fix. After that, a go.work file will appear in your project.

There may be no warning, however. If a generated workspace includes Go modules that are not replaced in the original go.mod, the warning is not shown due to possible side effects caused by migration.

generate go.work using 'replace' directives

Inspections: the 'Receiver names are different' inspection ignores generated code

According to Go recommendations, you should name a type’s receivers consistently. For example, if you call the receiver c in one method, don’t call it cl in another.

That recommendation is not really relevant for generated code. We disabled this inspection for files that contain a comment matching the following regular expression (as per the Go convention): ^//Code generated .* DO NOT EDIT\.$

Receiver names are different

Code documentation: Go doc comments

There are two types of links in Go doc comments: links and doc links.

Doc links are links of the form [Name1] or [Name1.Name2] to refer to exported identifiers in the current package, or [pkg], [pkg.Name1], or [pkg.Name1.Name2] to refer to identifiers in other packages.

Both links are rendered as links in the Quick Documentation popup and the Documentation tool window.

To see the Quick Documentation popup, press Ctrl+Q. To open the Documentation tool window, press Ctrl+Q again.

Code documentation: markup for headings and lists

Starting from Go 1.19, a heading is a line that begins with a number sign (#) followed by a space and the heading text. A list item consists of a star, plus, dash, or Unicode bullet, followed by a space or tab and then text.

markup for headings and lists
Last modified: 12 December 2022