GoLand 2021.1 EAP #4: Handle Errors With Ease, Generate All Getters and Setters at Once, and More
Early access build #4 for GoLand 2021.1 is here with lots of new quick-fixes for working with unhandled errors.
Remember that you don’t need to wait for the official EAP announcements, as we regularly release nightly builds based on the latest development code. These nightly builds are only available via the Toolbox App.
You can get this EAP build through the Toolbox App, by downloading it from the website, or by using a snap package (for Ubuntu). Or you can update from right inside GoLand by selecting Automatically check updates for Early Access Program in Preferences / Settings | Appearance & Behavior | System Settings | Updates.
Handle errors with ease
Are you aware of the Unhandled Error code inspection, which alerts you about functions or methods that return errors whenever the error isn’t being checked. This inspection is getting a whole family of quick-fixes!
The Handle error quick-fix assigns call results to variables and generates an
if error not nil check.
The Wrap error handling in a closure quick-fix, which is available for
go statements, produces code similar to Handle error but wraps everything in a closure.
Pro tip: Note that here the IDE copies the call receiver and the argument to avoid variables being captured by the closure and to preserve the semantics of the code. If you are sure you do not need additional parameters for the closure, invoke the Inline parameter refactoring (⌥⌘N on macOS or Ctrl+Alt+N on Windows/Linux) on them.
We’ve extended the Ignore explicitly application area to include
go statements. The quick-fix assigns the call results to blank variables, and wraps everything in a closure.
Generate all getters and setters at once
Generating get and set methods for each field in huge structs isn’t particularly enjoyable. You can now generate getters and setters for the whole struct all at once. Press Alt+Enter on any field name in the struct, then choose Generate getter and setters in the drop-down menu. GoLand will open the Select Fields window, where you can select all the fields, or just the fields you need, and generate their get and set methods.
Makefile Language plugin works by default
The Makefile Language plugin (previously 3rd-party), which provides GNU Make language support, is now bundled by default.
Starting with GoLand 2021.1, you will get syntax highlighting, quick documentation, Find Usages for targets, and some navigation and code completion actions for Makefile right out of the box!
Subscribe to Blog updates
Thanks, we've got you!
The GoLand 2023.3 Early Access Program Has Started!
The Early Access Program for GoLand 2023.3 is now open!
GoLand 2023.2 Reaches Beta!
The Beta provides all of the new features and improvements already announced during our current EAP cycle.
GoLand 2023.2 EAP #7: LSP API Support, and HTTP Client Improvements
This build includes support for LSP API and improvements for HTTP Client.