Go logo

GoLand

A cross-platform Go IDE with extended support for JavaScript, TypeScript, and databases

Early Access Program

GoLand 2021.2 Reaches Beta!

GoLand 2021.2 Beta is out! This means that we have stopped adding new features and are now focusing on perfecting the release. 

The Beta version is quite stable in comparison to Early Access Program builds, but please keep in mind that there may still be some small issues with it. 

This is the last build in the EAP cycle that does not require a subscription. 

For this release, we focused on adding new features for Go modules. There is also a new option for formatting, support for Go 1.17 features, and support for generics in .go files. We’ve added new quick-fixes, including one that will help you to use the new //go:build syntax correctly.

You’ll find version control updates, including the ability to sign Git commits with GPG keys. There are also some UI improvements, such as a better view of attached projects. For web developers, pages will reload in the browsers when code is saved, and there is completion for MongoDB fields and operators. 

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

Download GoLand 2021.2 Beta

If you would like an interactive introduction to the new features in this GoLand release, the new What’s New in GoLand 2021.2 course is available on the Learn GoLand tab of the Welcome screen. You’ll also find our new Onboarding tour there. It can help you quickly get acquainted with GoLand, and it will give you an overview of how to run and debug code and how to use the IDE’s features.    

Go Modules

Load go.mod changes manually

Previously, when you edited go.mod files, GoLand would automatically run go list commands after every modification. This obstructed the editing process, especially in large projects. 

You can now control this behavior. If you don’t want GoLand to run go list commands automatically, go to Preferences/Settings | Build, Execution, Deployment | Build Tools, where you’ll find the Reload project after changes in the build scripts checkbox. 

If you select the External changes option, go list commands won’t be executed automatically when you edit files inside GoLand. You will instead see a Load Go modules Changes icon, which you can click to load the changes when you are finished editing.  

If you untick the Reload project after changes in the build scripts checkbox, you will see the Load Go modules Changes icon on all types of changes – both external and internal ones. 

We believe that there is no need to disable automatic reloading, but if you find it useful to do so, please get in touch with us. We would love to know more about your use cases.   

Better support for different Go versions

If you use features from a version of the Go language that is newer than the one specified in your go.mod file, you’ll get an error, and GoLand will tell you what’s wrong.

For numeric literals and //go:embed statements, a quick-fix is available that will change the Go version in go.mod.

Dealing with unused dependencies

There may be situations where you need to specify a module that isn’t used anywhere in your code in a replace directive. 

These unused dependencies used to be highlighted in red. Now, to help distinguish them from errors, they are highlighted in grey. If you hover over one of the grey lines, you will see an “Unused dependency” message.

If you need to download the unused modules, press Alt + Enter (⌥ + ↩) and choose the Download all modules to the module cache option. You can also download individual modules. 

Formatter

Go has the gofmt tool for formatting your code, and GoLand also has its own formatter. 

There are various ways to enable “gofmt” in GoLand, but users have regularly asked us to make enabling it more discoverable or to set it to be used by default. 

In this release, we have introduced the Run gofmt on code reformat option. It’s enabled by default and can be toggled in Preferences/Settings | Editor | Code Style | Go

When this option is checked, you can invoke both formatters with the shortcut Ctrl + Alt + L (⌘ + ⌥ + L), and “gofmt” will be run after GoLand’s formatter. This will apply both the user settings and the default style.

This is just our first step towards making gofmt more discoverable. We have more changes planned.

Go 1.17

In Go 1.17 it will be possible to convert a slice to an array pointer. GoLand will not mark these conversions as errors. To try out the Go 1.17 features, change GOROOT to “Go 1.17beta1” in Preferences/Settings | Go.

Generics a.k.a. type parameters

We’ve been providing experimental support for generics since GoLand 2020.2. You can turn this feature on using the Enable generics (experimental support for type parameters) setting in Settings/Preferences | Go

The experimental support for generics in GoLand used to only be available in files with the .go2 extension. Now GoLand supports type parameters in .go files, too. It no longer suggests renaming the file, but you will still need to enable support for generics in the settings or through a quick-fix. 

More quick-fixes 

Support for the new //go:build constraints formatting

Last year, the authors of Go suggested that //+build constraints syntax should be changed to the new //go:build syntax.

During this transition period, according to the new syntax, you can only place //go:build constraints at the top of the file. If you place them anywhere else in the file, GoLand will suggest a quick-fix that will move the //go:build lines to their proper location. 

In Go 1.16, you have to use the old syntax or both of them. We recommend getting used to the new one though. You can write //go:build lines, and if there are no //+build lines, GoLand will suggest a quick-fix that generates them.  

Enable cgo support with one click 

If you imported the “C” package but forgot to enable cgo support in the project settings, the IDE will display a banner with the Enable cgo support quick-fix.  

There is also the Navigate to cgo import option, which will put the cursor at the beginning of the package’s name. This can help you find the import statement in a big project. 

There is also the option to Edit Go project settings, which opens a window with the settings for Build Tags and Vendoring, and you can enable cgo support, among other things. 

Debugger

Preview mode now works when you debug your application. It lets you open files successively in one tab. This helps you avoid cluttering the editor with multiple open files in separate tabs. 

To enable preview mode during debugging, go to Preferences/Settings | Editor | General | Editor Tabs and tick the Enable preview tab checkbox. 

Quick navigation

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

VCS updates 

GPG signature

You can sign your commits with a GPG key to secure them. This feature can be enabled via Preferences/Settings | Version Control | Git. If this is your first time using a GPG key, you’ll need first to configure it. With an existing preconfigured GPG key, you just need to select it from the drop-down list. 

New options in 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. Please be aware that the Run tests option is only available if you tick the Use non-modal commit interface box in Preferences/Settings | Version Control | Commit

New search field in Local history menu

We’ve improved the Local History menu, which helps you track changes independently of version control. We’ve added a new search field to it to help you to quickly find the text you are looking for in your Local History revisions. To try it out, right-click on the file and go to Local History | Show History. Please note that Local History shouldn’t be used as a substitution for VCS. We recommend making VCS your default choice for tracking changes and using Local History as a last resort.  

Changelists renamed

GoLand has been using “Default Changelist” as the name for the node that stores all uncommitted changes. We’ve made the phrasing more precise by using the word “Changes” instead of “Default Changelist”. This update will be available by default in your new projects. 

The IDE will no longer add changelists automatically for Git operations. So, for example, a cherry-pick won’t trigger the creation of a changelist. 

If you prefer automatic changelist creation, you can activate it in Preferences/Settings | Version Control by ticking the Create changelists automatically checkbox.

UI improvements 

Clearer understanding of Go and GOPATH projects on the Welcome screen

As GOPATH-based projects are becoming less and less popular, the way projects were previously named is no longer suitable. We’ve made the Go project the default for Go modules and renamed GOPATH-based projects to Go (GOPATH).

Better view of attached projects 

Previously, when you attached projects, they would be represented in the Project view as child directories of the existing project. We decided to change that because the actual location of these projects on your computer could be very different from what was shown in GoLand. Attached projects will now appear in the Project view as separate directories.   

Advanced settings and navigation arrows

We’ve added a new Advanced Settings node to Preferences/Settings. It contains additional configuration options, allowing you to, for example, configure a left margin for Distraction-free mode. 

There is also a new navigation option in Preferences/Settings. You can now navigate back and forth between sections using the arrows in the top right corner of the window. 

Update notifications from the Toolbox App

With this feature, you won’t miss any important updates from our Toolbox App. GoLand will inform you when a new version is available and give you the option to update to the new version right from the IDE. You need to have Toolbox App version 1.20.8804 or later for this.    

New terminal options

You can change the cursor shape in the built-in terminal to underline or vertical by going to Preferences/Settings | Tools | Terminal.

There is also a new option in the Terminal settings: we now support the Use Option as Meta key option. The Meta key temporarily modifies the normal action of another key when they are pressed together. Using the Meta key will help if you use the terminal a lot.

For instance, you can now use the following shortcuts to cut down on the time you spend navigating through the terminal: 

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

New Change Project Icon window

We’ve streamlined the dialog that allows you to customize your project icon in the projects list on the Welcome screen. To upload a custom icon, just right-click on any project and select Choose project icon from the context menu. 

Web development 

Browser pages reload on save

As you may know, GoLand lets you preview HTML files in a browser using the built-in web server. The IDE can now update the page in a browser as you edit and save HTML, CSS, or JavaScript files. 

To give this feature a try, open an HTML file, click on the icon of your favorite browser in the top right-hand corner of the window, and make some changes to your project. 

Page reloading is turned on by default. If you want to turn it off, go to Preferences/Settings | Build, Execution, Deployment | Debugger | Built-in Server.

Code completion for private npm packages

Adding new project dependencies in project.json has become easier, as code completion now works for private npm packages. The IDE will let you browse information about the latest versions of the package, just like it does for public packages.   

Generic support for web-types

We are introducing a new version of web-types – an open-source standard for documenting various web frameworks. Its initial version was focused only on Vue.js support. This blog post from the WebStorm team describes web-types in more detail. 

With this release, we want to build a new architecture to make it easier to support new JavaScript frameworks and extend support for the existing frameworks. The WebStorm team recorded a webinar that will help you to understand how you can use web-types in your projects.  

Support for TypeScript types in JSDoc comments

We reworked and expanded the support for TypeScript syntax used within JSDoc comments in .js files. GoLand recognizes more syntactic constructs, and we’ve fixed a lot of known issues, too. For example, optional properties in @typedef declarations are now supported. 

The Rename refactoring now works for React hooks

You will no longer need to spend a lot of time refactoring useState values and functions one by one in React hooks – GoLand can now rename them for you! Just place the caret on a state value and invoke the Rename refactoring with ⇧F6 / Shift+F6 or by going to Refactor | Rename from the right-click context menu.

Work with databases

Code completion now works in the MongoDB console for fields, nested fields, and fields inside aggregation expressions. It also works for query and projection operators, update operators, and aggregation stages.  

Other changes 

UI in Chinese, Japanese, and Korean

Starting from this version, you can enjoy the fully localized GoLand UI in Chinese, Korean, and Japanese. Localization is available as non-bundled language pack plugins, which can be easily installed in GoLand

Automatic cache and logs cleanup

Goland will automatically clean up cache and log directories that were last updated more than 180 days ago. This process won’t affect your system settings and plugin directories. You can clean up the logs and caches manually using the Help | Delete Leftover IDE Directories… action.

Intelligent spelling and grammar checks in Go files

We’ve enabled intelligent spelling and grammar checks in Go files by default. These checks are provided by the Grazie plugin, which is bundled with the IDE. To adjust the settings, go to Preferences/Settings | Editor | Proofreading | Grammar, where you will find the Scope, Rules, and Exceptions sections.

Actions on save

We’ve collected all the possible on-save actions together in Preferences / Settings | Tools | Actions on Save. You can now configure all of them there – just tick the checkbox next to the action you want to enable, and GoLand will trigger it on any save, including both autosave and explicit save actions.

You can also configure the settings for any action more precisely. To do so, hover over it, click the configuration link, and fine-tune this action on the related settings page that appears. Some of these on-save actions were already available via the ⌘S / Ctrl+S shortcut.

Code With Me

You can now keep track of which code completion suggestions GoLand offers to your colleagues during Code With Me sessions. To use this feature, you need to be in Following mode. 

Bug-fixes and other improvements

GO-8064 – Unnecessary package import aliases are no longer introduced when moving files between directories.

GO-11137Computing variable presentation no longer blocks the debugger when you step over code.

That’s it! Try our new features and tell us what you think. As always, you can leave a comment here, open an issue in our tracker, tweet us at @GoLandIDE, or leave a message in the Gophers Slack #goland channel. 

image description