What's New in GoLand

In GoLand 2020.3 you can explore the goroutines dump, run and navigate to individual table tests, and get more from the expanded support for the Testify test framework. You will also find many new code editing features, including support for time package, smarter ways to handle packages, UI improvements, a variety of new features for web development and working with databases, and a new service for collaborative development and pair programming.

Prefer to learn interactively instead of reading? Complete the What's New in GoLand 2020.3 tutorial inside the IDE on the Welcome screen.

Debugger improvements

Exploring goroutines stack in the debugger

The new Dump Goroutines icon in the debugger lets you easily find goroutines that contain a specified string in the stack during the debug session. Simply click the icon to open a dump in a separate window.

To help you keep focus on information that matters, there is the option to hide an individual goroutine or goroutines with the same stack. Right-click on a goroutine and select the desired action or just press delete to move it to a special Hidden section in the dump window where it won’t distract you.

Stopping 'Go Remote' configuration

GoLand 2020.3 brings the ability to stop a process with Go Remote configuration if no reattach is required.

In your configuration settings you can specify the default behavior of the debugger on disconnect, you can choose Stop remote Delve processes, Leave it running, or have GoLand ask you how to proceed each time.

Testing enhancements

Running an individual table test

Support for table tests

You can run and navigate to individual table tests from the Run tool window.

There are some limitations:

  • The test data variable must be a slice, an array, or a map. It must be defined in the same function as the call and must not be touched after initialization (except for range clauses in a for loop).
  • The individual test data entry must be a struct literal. Loop variables used in a subtest name expression must not be touched before the call.
  • A subtest name expression can be a string field in the test data, a concatenation of test data string fields, and an fmt.Sprintf() call with %s and %d verbs.
GoLand suggests an argument inside test functions

Expanded support for Testify

The IDE now recognizes the test function that starts a test suite, and provides a way to start an individual suite.Run and suite.T().Run, as long as the subtest name is a string constant. In addition, it is possible to rerun a subtest from the Run tool window to avoid rerunning the entire top-level test.

In addition, GoLand can now run Testify suites with the same method name separately within a single test case.

Last but not least, when you complete a function or method that accepts testing.T as the first argument, GoLand passes that argument automatically if possible. This works for functions and methods of testify/assert, testify/require, testify/mock, and testify/suite packages.

Code inspections

GoLand warns about a potential problem in the editor and shows the 'Add format string argument' intention

The Incorrect usage of Println/Printf like functions code inspection will warn you about potential problems in github.com/pkg/errors, github.com/sirupsen/logrus, and go.uber.org/zap packages.

On top of that, we’ve added placeholder highlighting and folding, as well as the Add format string argument intention.

GoLand provides a warning when an execution path doesn't call the cancel function

The context.CancelFunc not called code inspection reports potentially unsafe uses of context cancellation. This is especially useful when the ‘cancel’ function returned by context.WithCancel (and similar functions) isn’t called on all execution paths.

To learn more about this package, please visit: https://golang.org/pkg/context/.

Code editing

GoLand provides code completion for time layout

Support for time package

We’ve added support for the time package so you can work with time and duration more easily. GoLand will suggest elements of predefined layout via code completion(Ctrl+Space) as YYYY, MM, DD placeholders from ISO-8601.

Press Ctrl+P on a token, and the IDE will show its meaning. There is also syntax highlighting for layout tokens. Code completion also suggests standard time layouts outside of the string literal.

Excluding package from import and code completion via Alt+Enter

Smarter package handling

The IDE is now smarter at prioritizing completion items for packages that you use frequently and that are explicitly declared in the go.mod file of your project.

We’ve also added an option to exclude packages completely from your project import path and completion suggestions. You can do this via Alt+Enter or in the new Exclude for import and completion window in Settings | Go | Imports.

GoLand uses a different color to highlight variables that shadow any existing declaration

Support for variable shadowing

GoLand makes it easier to spot variable shadowing:

  • The IDE shows variables that shadow any existing declaration in a different colour now.
  • Navigate to shadowing declaration intention action lets you immediately switch to the shadowed declaration.
GoLand supports square brackets in type parameters

Square Brackets in Type Parameters

We’ve followed updates from the design of generics by the Go team and added support for square brackets for the generics syntax instead of parentheses, as this was implemented in the previous proposal edition.

Please note that the Enable generics (experimental support for type parameters) setting in Settings | Go is turned off by default. You need to explicitly select that checkbox to start using the feature.

Read this blog post to learn more about type parameters.

Other improvements

GoLand shows 'Test' and 'Benchmark' Live Templates in the code completion suggestion list

When you type func in the test file, GoLand by default suggests bench and test Live Templates in the completion options.

GoLand suggests completing a for loop with b.N inside the benchmark

When you type for inside the benchmark, the IDE suggests completing it with a for loop with b.N.

GoLand suggests fixing a typo

Improved spelling and grammar checkers

Suggestions now appear immediately in the dialog when you press Alt+Enter. In addition, a new version of the LanguageTool grammar checking engine features improved checks for English and adds support for 10 additional languages.

Code With Me

'Code With Me' in action

GoLand 2020.3 supports Code With Me (EAP) – a new service from JetBrains for collaborative development and pair programming. Code With Me enables you to share the project you currently have open in your IDE with others and work on it together in real time.

Check out these posts to learn more about it.

UI improvements

Reworked Welcome screen

Reworked Welcome screen

We’ve reworked the Welcome screen to give you immediate access to:

  • Search for projects.
  • Settings to customize your IDE.
  • Plugins to expand the functionality of your IDE.
  • Tutorials to learn more about your IDE’s features.
'Sync with OS theme option in settings

Sync IDE theme with your OS preference

Select the Sync with OS option in Settings | Appearance & Behavior | Appearance | Theme to automatically switch your IDE theme to match your OS preferences.

Dragging a tab to split the editor

Drag and drop tabs anywhere to split the editor

Split the main editor screen horizontally or vertically by dragging a tab to the desired position and dropping it there. When you are dragging a tab, the editor will highlight where you can drop it.

Opening a second file in the editor

Project view updates

We’ve improved the UX when working with files from the Project view. Now, when you open a file from the Project view, the focus is automatically placed on the editor to allow you to start working with your code right away. Press the spacebar and the IDE will show you a preview of the file in the Project view.

If you want to have several files open in the editor simultaneously, you can now do so with one simple shortcut. Select the file in the Project view and press Shift+Enter to have the IDE split the Editor window and open the file in the right-hand part of it.

VCS updates

Reworked VCS menu

Reworked VCS menu

The VCS menu now adapts to version control system that you are currently using, making it easier to access key VCS features as they are no longer hidden in a submenu.

Git staging area

Support for Git staging area

There is an awesome new Git staging area available! Please note that this functionality is only available for the Commit tool window.

Tick the Enable staging area checkbox in Settings | Version Control | Git to turn it on. Once you do, support for changelists will be disabled.

In the commit UI, you will find staged and unstaged files. When you’re ready to stage a file, simply click the + icon next to it. The file will appear under the Staged node. To add your changes to the staging area, you can also use the gutter icon or Show Diff.

GoLand corrects an incorrect branch name

Improved work with branches

Work with branches has been improved:

  • The IDE now automatically corrects unaccepted symbols in the names of new branches, which helps you create branches in line with the accepted format.
  • The IDE will now show you all the actions available for the currently selected branch, just like it would for other branches.
  • For remote branches, we’ve renamed the Merge into Current and Rebase Current onto Selected actions to Pull into Current Using Merge and Pull into Current Using Rebase.

More features

Disabling a plugin for all projects

Plugins enabled per project

We’ve added the ability to enable plugins for the current project or for all projects by selecting Enable for Current Project or Enable for All Projects. In Settings | Plugins, press the gear icon on the plugin you want to enable or disable and select the desired option.

System shortcut keymap for macOS in settings

System shortcut keymap for macOS

macOS system shortcut keymap (Settings | Keymap) aims to provide you with an alternative macOS keymap that offers extended compatibility with system shortcuts and allows you to avoid using F-keys for essential actions.

Flame Graph in the Profiler in action

Profiler – Flame Graph

We’ve improved the search mechanism of the Flame Graph in the Profiler and its visualization to let you find method metrics faster. You can click on the magnifying glass icon or type your search request inside the Flame Graph panel.

Also, we’ve added a search field, up/down arrows for fast navigation between search results, and the ability to search either in the whole Flame Graph or just in a specific subtree.

Web development changes

Creating a React component from its usage

Create a React component from its usage

Courtesy of the WebStorm team, GoLand now has rich support for web development under the hood. One of the upcoming changes in this area is the ability to create a React component from an unresolved reference. Place the caret at an unresolved component, press Alt+Enter, and select the corresponding inspection.

GoLand found pnpm on the machine

Full support for pnpm

GoLand provides full support for the pnpm package manager, along with npm and yarn. When you open a project with a pnpm-lock file and have pnpm installed on your machine, GoLand will automatically change the package manager for this project to pnpm. The IDE also has a dedicated pnpm option in the list of package managers under Settings | Languages and Frameworks | Node.js and NPM.

Webpack settings

Basic support for multiple webpack configs

GoLand 2020.3 will let you choose between detecting webpack configuration files manually or automatically. The new options can be found in Settings | Languages & Frameworks | JavaScript | Webpack.

Work with databases

Adding Couchbase Query as data source

Couchbase support

Thanks to our colleagues from the DataGrip team, GoLand has expanded its family of supported databases with a new member – Couchbase! Please note that the IDE supports the Couchbase Query service, not the Couchbase Analytics service.

GoLand displays grants in an object’s DDLs

Support for grants

GoLand knows about object grants and displays them in an object’s DDLs. This works for MySQL, PostgreSQL, Greenplum, Redshift, and SQL Server.

GoLand displays the formatted value in a separate editor

Separate editor for cell values

We’ve improved the separate editor for cell values:

  • It now displays the formatted value even if the value is not formatted properly.
  • It’s possible to edit the value in the formatted view and update it with the original formatting in one-line XMLs and JSONs.
  • If the width of the screen is crucial to your flow, you can move the cell value editor to the bottom of the data editor.
  • This panel can now also display images!
'One-Row' extractor in action

Import/export for databases

We’ve added two new extractors to help make it easier for you to work with data:

  • One-Row will help you copy a column to a comma-separated string.
  • SQL-Insert-Multirow will generate a single INSERT statement with multiple new rows to be inserted.

In addition, there is now a new option in CSV format configuration: never quote values.