Early Access Program

GoLand 2021.3 EAP Build #2 Is Out!

The second build of the 2021.3 EAP is available for you to install. 

You can get the EAP build via the Toolbox App, download it from our website, use a snap package (for Ubuntu), or from inside GoLand, select Check IDE updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download GoLand 2021.3 EAP #2

Better representation of nil interfaces in the debugger 

Go, like any other programming language, has some gotchas. One of them is nil interfaces. 

Interfaces in Go have two components, a type and a value of that type. For an interface to be nil, both of these components must be nil

If in your program you have an interface with a value containing a nil pointer, that interface will not be equal to nil, because the inner type is not nil. This can be confusing.  

Go even has a section dedicated to this gotcha in its FAQ: 

If we store a nil pointer of type *int inside an interface value, the inner type will be *int regardless of the value of the pointer: (T=*int, V=nil). Such an interface value will therefore be non-nil even when the pointer value V inside is nil

To detect such cases, we changed how interfaces are represented in the debugger window. For instance, if you have an interface with T=*int, and V=nil, it will be shown like this:

{interface{} | *int} *int(nil)

Hopefully, this will help to avoid confusion. 

Short package names in the Debug window 

GoLand no longer displays the full package name in the debugger’s Threads & Variables window (previously called Variables). Now you will see only the last part of the full name. It should help you concentrate on the problem without being distracted by long lines.  

This change comes with the ability to show and hide object types in the Debug tool window, which was described in the previous EAP post. You might also notice that our debugger has a new UI that is a little more modern and minimalist. 

Quick-fix for error string formatting 

GoLand has an inspection that warns you about wrong formatting of error strings: “Error strings should not be capitalized or end with punctuation”. This rule is from the Go docs

The error strings should be lowercase and without punctuation, since they could be printed in the middle of the message. For example: 

log.Printf("Reading %s: %v", filename, err)

Capital letters and dots would be out of place here.  

Now we have a quick-fix for that rule. Press ⌥ ↩ (Alt + Enter), and GoLand will suggest fixing the string format.  

Project-wide default Run target

You can now set a project-wide default run target. Go to Run | Edit configurations | Manage targets. A window will open containing the Projects default target option. 

If you choose a particular target for the project, all new configurations will be created with this target. This feature will be useful for those who run several configurations on the same target. 

New Bookmarks window 

In GoLand, we have two very similar instances – Favorites and Bookmarks. As the difference between the two could sometimes be confusing, we’ve decided to stick to just one – Bookmarks. We’ve thoroughly reworked the workflow for this functionality and made a new tool window for it.  

From now on, all the files, folders, and classes that you mark as important with the F3 shortcut on macOS or F11 on Windows/Linux will be located in the new Bookmarks tool window. 

When you add a bookmark, GoLand puts it in the node named after your project. The IDE automatically creates this node beforehand and stores all your prioritized items there by default. New bookmarks will appear at the top of the list inside this node. However, you can organize them manually by dragging and dropping them to new lists, which you can name according to your needs. 

If you prefer to work with one list, it is possible to sort your bookmarks using the Sort Groups and Bookmarks option in the tool window’s settings. 

VCS improvements

Checkout and Rebase onto Current for remote branches

The Checkout and Rebase onto Current action allows you to check out the selected branch and rebase it on top of a branch that is currently checked out. Until now, it has only been available for local branches. Starting from this EAP, we’ve added the ability to apply this action to remote branches, as well. 

Reorganized VCS settings

To improve the user experience and speed up the process of configuring your version control systems, we’ve made the VCS settings more discoverable and more clearly structured. Here are some of the changes you’ll find in Preferences/Settings | Version Control.  

The Version Control node now lists all the available settings. You can easily navigate to the settings by clicking on them. 

We’ve improved the layout inside the Git node. We divided all the settings into sections that account for the most important processes: Commit, Push, and Update. Additionally, the parameters inside these sections are now organized more logically. 

We’ve added a separate node for Directory mappings, and the background operations are now switched on by default. The Background node no longer exists. 

Other Improvements and bug fixes 

GO-11716, GO-11717 – The Force step over and Force run to cursor actions in the debugger work as expected.   

GO-9182 – Navigation icons, parameters hints, and recursion marks are now shown in generated files.  

GO-11653 – The Export quick-fix is renamed to Export type or Export function/method depending on the context.

GO-11614 – The debugger shows the time value assigned to an interface as expected.  

GO-11520 – The Show members option works for nested files.   

GO-11613 – The Add comment quick-fix now works for methods with common names like Read(), Write(), etc. 

That’s it for today! Let us know what you think about the new features. Leave your comments here, tweet us, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel. Thanks!

image description