GoLand 2022.2 EAP #2 Is Out With New Inspections For Generics
The second build of our 2022.2 Early Access Program is here.
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 Check IDE updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.
Generics
Report unused type parameter
There is a new inspection that reports unused type parameters. They are grayed out, and you will see a warning when hovering over them.
Quick-fix to delete a type parameter with an empty parameter list
Type parameters with an empty parameter list are now reported as errors. There is also a quick-fix to delete such type parameters. You can use the quick-fix from the popup window that appears when you hover over a type parameter or press ⌥ ↩ (Alt + Enter) to see all available quick-fixes.
Report union of interfaces with methods
The IDE now reports an error if you attempt to use interfaces with methods in unions. This limitation was introduced by the Go team and you can read more about it here.
Completion for a type parameter when typing a method’s receiver
GoLand automatically inserts a type parameter’s identifier when you type a receiver while creating a method (it could be any letter, but is usually the same as in the type’s declaration).
Improvements and bug-fixes
This build also includes some fixes that hopefully will make working with type parameters more enjoyable. For instance, GoLand doesn’t complain about using a generic callback function with several parameters anymore – this false-positive error has been fixed. Overall, we’ve fixed 290+ generics-related issues to date.
Report 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 (for details see “Should I define methods on values or pointers?” and “Why do T and *T have different method sets?‘).
There is a new inspection in GoLand that will warn you if your type has methods on both value and pointer receivers. As usual, you can place the cursor on the highlighted code and press ⌥ ↩ (Alt + Enter) to change the inspection’s severity or other details.
We’ve also updated the quick documentation – now the tooltip that appears when you hover over a type lists methods on value and pointer receivers separately.
Improved quick documentation for iota
We’ve updated quick documentation for iota
. Now it contains additional information about how to use iota
. Hopefully, this will be helpful, especially to those new to the language.
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 by holding ⌘ (Ctrl) and clicking on a link. You can also generate a request in the HTTP client by pressing⌥ ↩ (Alt + Enter) and choosing the corresponding option from the context menu.
That’s it for today! We would love to hear what you think about the new features. Ping us on Twitter, leave your comments here, open an issue in our tracker, or drop us a message in the Gophers Slack #goland channel. Thank you!