Early Access Program GoLand

GoLand 2021.2 EAP Build #2 Is Here!

GoLand 2021.2 EAP build #2 is out and ready 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 Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download GoLand 2021.2 EAP #2

Download modules on demand 

GoLand has the Sync dependencies action, which fetches missed dependencies and removes unused ones by calling go mod tidy/vendor. It works a little bit differently with replace directives in go.mod files. 

Earlier, if you specified a module that wasn’t used anywhere in your code (but you still wanted to have it) in the replace directive, the IDE wouldn’t download or delete it, and the lines with these unused dependencies would be marked red. It didn’t affect how the application worked, but those red lines have been confusing our users and causing them to look for errors. 

This new feature will help resolve such situations. If you run Sync dependencies and you still see red lines in the go.mod file, click on the red bulb or use Option + Enter (Alt + Enter). You will see a couple of options apart from Sync dependencies – download a particular module or all the specified modules to your cache. 

In a future EAP build, we’re also planning to mark differently any modules that are not required by your code or any of its dependencies. These lines will be highlighted as unused.  

Support for generics in .go files

Last June, the Go team announced a draft design for generics, a.k.a. type parameters. In March 2021, this draft design became a proposal. Generics should be available in the Go 1.18 release in early 2022. 

Since GoLand 2020.2, we’ve been providing experimental support for generics. You can play with them by turning on the Enable experimental support for generics a.k.a. type parameters setting in Settings/Preferences | Go. The details about how to use type parameters in GoLand are available in our documentation

Previously, experimental support for generics in GoLand was only available in files with the .go2 extension. It was done this way so that this experiment wouldn’t interfere with the rest of the work. If you wrote some code with generics in .go files, the IDE would suggest renaming them with the .go2 extension. 

We now think that experimental generics support in GoLand is stable enough, so with this EAP release GoLand provides support for type parameters in .go files, too. It no longer suggests renaming the file, but you still need to enable support for generics in the settings or through a quick-fix. 

Clearer messages about settings mismatch 

This feature suggests an explicit call to action if the settings of the target system in your project don’t match your code.  

Let’s say you imported the “C” package, which allows calling C code from Go, but didn’t enable cgo support in the project settings. 

The IDE will suggest Navigate to cgo import, which will put the cursor right before the package’s name. You can also Enable cgo support with one click without needing to go to Preferences/Settings | Go | Build Tags and Vendoring. As earlier, there is an option to Edit Go project settings. It opens a window with the settings for Build Tags and Vendoring.   

Find implementations of “internal” interfaces easily 

Starting with this release, you can Navigate to implementations of the interfaces contained in the internal folder. To jump to the implementations, click on the gutter. You can also jump back to the interface from its implementations.  

Version control improvements 

This EAP release brings you some new pre-commit checks. You can now Run tests and Analyze code before committing your changes. Go to Preferences/Settings | Version Control | Commit | Before commit or click on the gear icon in the Commit view. GoLand will show the progress and the results of pre-commit checks in the Commit area without opening additional modal windows.  

We’ve also improved the Local History menu, which helps you track all changes independently of version control. We’ve added a new search field here to quickly find necessary text in your Local History revisions. To try it, right-click on the file and go to Local History | Show History

New terminal options 

Some of you probably have always wanted to use the underline or vertical cursor shape in our built-in terminal – we made it happen! To change it, go to Preferences/Settings | Tools | Terminal.

There is also one new option in the Terminal settings: we now support Use Option as Meta key

This may sound familiar – macOS native terminal has this option. The Meta key temporarily modifies the normal action of another key when they are pressed together. For instance, you can now use the following shortcuts when working in the terminal: 

  • Option + F – go to the next word
  • Option + B – go back a word
  • Option + D – delete the next word 

Using the Meta key can improve your productivity if you use the terminal a lot.       

That’s it for today. Please tell us what you think about these new features. Leave a comment here, ping us on Twitter, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel. Thanks!

image description