GoLand 2022.2 Goes Beta!
GoLand 2022.2 has reached the Beta milestone! During the next couple of weeks, we will be fixing bugs and getting GoLand ready for the major release at the end of July. This is the last build in our EAP cycle that doesn’t require a license.
You can get the build via the Toolbox App, download it from our website, use a snap package (for Ubuntu), or upgrade directly from inside GoLand, select Check IDE updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.
Generics
Intention action to convert empty interfaces to ‘any’
GoLand now has an inspection that reports the usage of an empty interface as a type or type constraint.
There is also an intention action that will help you quickly replace interface{}
with any
. From the intention action’s popup, you can replace all empty interfaces in a file.
Quick-fix to delete a type parameter with an empty parameter list
Type parameters with empty parameter lists are now reported as errors. We’ve added a quick-fix to delete them.
Inspection for unused type parameters
We’ve added a new inspection that reports unused type parameters. They are grayed out, and you will see a warning when you hover over them.
Inspection for union of interfaces with methods
The IDE now reports an error if you attempt to use interfaces with methods in unions.
Inspection for usage of a type parameter as a constraint
If you try to use a type parameter as a constraint, GoLand will display an error.
Completion for type parameters when typing a method’s receiver
GoLand automatically inserts a type parameter’s identifier when you add a receiver while creating a method.
New Find Usages group for type parameters
We’ve introduced a new Find Usages group for generics: Type parameter declaration.
Fuzz testing
You can now run fuzz tests from GoLand. If you click on the green triangle icon in the gutter next to your fuzz test, you will see different options for running the test. If the test fails, the failing seed corpus entry will be written to a file and placed in your package directory in the testdata folder.
The path to this file will also appear in the console as a clickable link. If you click on the link, the file will be opened in the IDE, and you will see a green triangle icon at the top of the file. Clicking on this icon will run go test with the failing seed corpus entry.
Go Workspaces
Quick-fix for grouping multiple use directives
We’ve added a quick-fix that groups multiple use
directives in a go.work
file into one directive.
Go 1.19
Support for the unix build constraint
GoLand now supports the new unix
build tag, which matches any Unix or Unix-like system.
Support for fmt.Appendf
We’ve added support for fmt.Appendf
, and now GoLand identifies formatting verbs inside strings. As a result, the Appendf
function benefits from all of the features that formatting functions have, like the Add a format string argument intention action.
Addition of loong64 to the Arch list
Go 1.19 is introducing a new architecture – loong64
. We’ve added it to our Arch list in Preferences/Settings | Go | Build Tags & Vendoring.
Quick Documentation
We’ve improved Quick Documentation:
- For each of the 25 Go keywords, GoLand now displays a meaningful keyword tooltip outlining the semantics of the relevant keyword.
- We now display channel direction information. This data is shown in tooltips in three places: when you hover over the
chan
keyword, on channel send and receive operations, and on all references to channel types. - Quick documentation for
iota
now contains additional information about how to use it. If a constant is part of aniota
group, the value is now shown in the completion box, even if the constant is defined implicitly. - If you invoke Quick Documentation on a type parameter, GoLand will show you a tooltip with a brief explanation of how generics work and a link to a tutorial by the Go team.
- There’s also a new tooltip explaining how type switches work.
- The tooltip for type assertions now contains additional information about them and offers examples.
- GoLand displays additional information when you initialize maps, arrays, slices, and structs if you hover over the area inside the curly braces.
- If you hover over a blank identifier, GoLand shows a tooltip with information about what the blank identifier is and how it works.
More Go-related improvements
Performance optimization
We decided to stop scanning the cache
subdirectory in ~/go/pkg/mod
since it doesn’t contain information that is needed for GoLand to work correctly. This folder can be fairly large, and we hope that excluding it from the scan will improve performance.
Support for the go:linkname directive
The go:linkname
compiler directive is now supported, and the Missing function body false-positive error has been fixed.
Irregular usage of iota inspection
A new inspection will warn you if iota
is used irregularly.
We’ve also enabled the Reserved word used as name inspection for iota
and other built-in constants. The inspection will be triggered if you try to assign a value to a constant named iota
, true
, or false
.
Inspection for methods on both value and pointer receivers
The Go documentation recommends that all methods on a given type should have either value or pointer receivers.
There is a new inspection in GoLand that will warn you if your type has methods on both value and pointer receivers.
Automatic SQL detection
SQL statements are now automatically detected and the language is injected into every string literal that matches a certain pattern. When you inject a language into a string literal, you get comprehensive code assistance when editing that literal.
You can find the patterns, edit them, and add your own in Preferences / Settings | Editor | Language Injections.
Run Anything
GoLand now supports a Run Anything action that allows you to quickly launch run/debug configurations, applications, scripts, commands, and tasks, as well as open recent projects. To use it, just press ^ (Ctrl) twice and start typing in the search bar.
HTTP Client
Support for WebSocket endpoints
GoLand now supports WebSocket connections. You can create requests as well as send and receive messages.
Support for GraphQL endpoints
GoLand can now send GraphQL queries over HTTP and WebSocket protocols out of the box. For http://
and https://
, simple HTTP requests are used, while ws://
and wss://
are delegated to the WebSocket executor.
Select a run environment
There is now a way to select a run environment using an icon on the gutter. To enable this feature, choose the Select Environment Before Run option from the Run with combobox.
User interface
Merge All Project Windows action on macOS
For macOS users, we’ve introduced the ability to merge all open project windows by turning them into tabs within a single window. To do this, go to Window | Merge All Project Windows.
Keyboard shortcut to change the font size
We’ve introduced a keyboard shortcut that changes the font size everywhere in the editor. To increase the font size, press ⌃⇧Period (Alt+Shift+Dot). To decrease it, press ⌃⇧Comma (Alt+Shift+Comma).
When you zoom into or out from your code within the editor, you can now see an indicator that shows the current font size and the option to revert it back to the default.
New Description field for mnemonic bookmarks
We’ve integrated a Description field into the Add Mnemonic Bookmark dialog so that you can add an optional description to your bookmark. To add a mnemonic bookmark, right-click the gutter next to the line you want to bookmark and choose the corresponding option from the context menu. Or you can use the shortcut ⌥ F3 (Ctrl+F11).
Cloning repository progress bar
The Cloning repository progress bar is now shown right in the Projects list.
Faster access to Сode Сompletion settings
You can now access Code Completion settings from the vertical ellipsis menu button in the code completion pop-up.
Editor
Control automatic parentheses insertion
We’ve added the option to toggle whether the IDE automatically inserts parentheses during code completion.
Change the highlighting style for inspections
You can adjust the highlighting style for an inspection using the new Highlighting in editor dropdown menu in Preferences/Settings | Editor | Inspections.
This change gives you more options for customizing inspections. For example, you can set the severity level of a particular inspection to Warning but change the highlighting style to Error.
Docker
Docker auto-connection on IDE restart
GoLand now automatically connects to Docker after you restart the IDE. This new setting is enabled by default in Settings / Preferences | Advanced Settings | Docker.
Integration with Colima and Rancher
GoLand is now integrated with Colima and Rancher to support more options for establishing connections to a Docker daemon.
Copy Docker Image
You can now easily copy images from one Docker daemon to another using the new Copy Docker Image action, which saves the image to a file and then pushes it to the chosen connection.
Databases
Option to import multiple CSV files
You can now select several CSV files and import them all at once.
Resolve modes for databases
When working with the databases, you now have two file resolve modes: Playground and Script. Playground is for when you have a set of unconnected queries, and Script is for queries that have sequential logic.
Other notable improvements
Import trusted SSL certificates
GoLand can now help you import trusted SSL certificates from system trust stores. It will automatically use the custom certificates specific to your enterprise environment. You don’t need to perform any additional actions.
Clickable URLs in JSON and YAML files
JSON and YAML files now feature automatically inserted web references inside values that start with http://
and https://
. You can open these links in a web browser and generate requests in the HTTP client.