GoLand 2021.2 introduces new features for Go modules, a new option for formatting,
and support for Go 1.17 features.
We’ve added new quick-fixes,
including one that will help you use the new //go:build
syntax correctly.
Version control has been updated, and the improvements include the ability to sign commits with GPG keys. For web developers, we’ve added automatic page reloading in browsers when code is saved, and there is completion for MongoDB fields and operators.
Would you prefer a more interactive approach to learning about these new features in GoLand? Complete the What's New in GoLand 2021.2 tutorial from the Welcome screen. You’ll also find our new Onboarding Tour there. It can help anyone new to GoLand quickly get acquainted with it.
In GoLand 2021.2 you can control how the IDE makes calls to go list
when you edit
go.mod
,
and you can load go.mod
file changes manually.
Go to Settings | Build, Execution, Deployment | Build Tools,
and select the External changes option.
GoLand will then stop making calls to go list
automatically when you edit files inside the IDE.
You will instead see a Load Go modules Changes icon, which you can click to manually 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.
GoLand will display an error if you are using features that are from a newer version of Go than the one specified in your
go.mod
file.
For numeric literals and //go:embed
statements,
a quick-fix is available that will change the Go version in go.mod
.
The Go option on the Welcome screen is now the default option for Go modules projects. We have also renamed GOPATH-based projects to Go (GOPATH).
Unused dependencies in replace
directives are now highlighted in grey.
This will help distinguish them from errors.
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.
In this release, we have introduced the Run gofmt on code reformat option.
It’s the first step towards making gofmt
more discoverable in GoLand, which has its own formatter.
When this option is checked,
you can invoke both formatters with a shortcut, Ctrl+Alt+L,
and gofmt
will be run after GoLand’s formatter.
This option is enabled by default and can be toggled in Settings | Editor | Code Style | Go.
GoLand has a couple of new quick-fixes to help you correctly use both the old
// +build
constraints
and the new //go:build
syntax.
The first quick-fix will move the //go:build
lines to the top of the file,
as the new syntax requires.
And since in Go 1.16 you can use either the old syntax or both of them together,
there is a quick-fix for generating // +build
lines in addition to //go:build
lines.
If you imported a “C” package but then forgot to enable cgo support in the project settings, GoLand 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.
Preview mode now works when you debug your application. It lets you open the files successively in one tab, which helps you avoid cluttering the editor with multiple open files in separate tabs.
To enable Preview mode during debugging, go to Settings | Editor | General | Editor Tabs and tick the Enable preview tab checkbox.
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.17" in Settings | Go.
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.
GoLand 2021.2 allows you to sign commits with a GPG key to secure them. This feature can be enabled via Settings | Version Control | Git.
If this is your first time using a GPG key, you’ll first need to configure it. If you have an existing preconfigured GPG key, you can just select it from the drop-down list.
You can now Run tests and Analyze code before committing your changes. Go to Settings | Version Control | Commit | Before commit or click on the gear icon in the Commit view.
Please be aware that the Run tests option is only available if you tick the Use non-modal commit interface box in Settings | Version Control | Commit.
We’ve added a new search field to the Local History menu, which tracks changes independently of version control. It can help you 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.
We have a new name for the node that stores all uncommitted changes. Previously it was called Default Changelist; now it's called Changes. This update will be available by default in all new projects. Also, Git operations will no longer trigger the automatic creation of changelists.
We have changed how attached projects are represented in the Project view. They used to be represented as child directories of the existing project. Attached projects now appear in the Project view as separate directories.
We’ve added a new Advanced Settings node to 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 Settings. You can now navigate back and forth between sections using the arrows in the top right corner of the window.
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. To use this feature, you need to have JetBrains Toolbox App version 1.20.8804 or later.
You can now change the cursor shape in the built-in terminal to underline or vertical by going to Settings | Tools | Terminal.
There is also a change in the Terminal settings. We now support the Use Option as Meta key setting. A Meta key temporarily modifies the normal action of another key when they are pressed together. Using a Meta key can be helpful if you use the terminal a lot.
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 a project and select Choose project icon from the context menu.
GoLand can now update the page in a browser as you edit and save HTML, CSS, and JavaScript files.
Page reloading on save is turned on by default. You can toggle it in Settings | Build, Execution, Deployment | Debugger | Built-in Server.
Refactoring now works for useState
values and functions in React hooks.
Just place the caret on a state value and invoke the Rename refactoring
with Shift+F6 or by going to Refactor | Rename from the right-click context menu.
GoLand can add missing import
statements as you complete ES6 symbols, and now
it can do the same for CommonJS modules – require()
imports will be inserted on Code
completion.
Code completion now works for private npm packages. GoLand will let you browse information about the latest versions of the package, just like it does for public packages.
We are introducing a new version of web-types – an open-source standard for documenting various web frameworks. Web-types' initial version was focused only on Vue.js support.
We want to build a new architecture to make it easier to support new JavaScript frameworks and extend support for the existing ones. This blog post and a webinar from the WebStorm team will help you understand how you can use web-types.
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.
We’ve collected all the possible on-save actions together in 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.
You can also configure the settings for any action more precisely. To do so, hover over it, click the configuration link, and fine-tune the action on the related settings page that appears.
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.
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 Settings | Editor | Natural Languages | Grammar.
GoLand now has a fully localized UI in Chinese, Korean, and Japanese. Localization is available as non-bundled language pack plugins, which can be easily installed in GoLand.
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.