The Go Workspace File Action and Performance Improvements in GoLand EAP 2022.3 #2
The second build of our 2022.3 Early Access Program is out now.
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.
The Go Workspace File action
In the New context menu, you’ll now find the Go Workspace File action. Select it, and a go.work
file will appear in your root folder. Existing Go modules will automatically be added to the go.work
file.
The Go playground inside GoLand
We’ve implemented a feature that simulates the Go playground functionality inside GoLand.
You can select a piece of code, choose the Open in option and then click Playground. This will open a scratch file with a toolbar which contains the same options you have when using the Go playground.
You can format and share your code, change the Go version, run your code using the Go playground server, or run it locally.
You also have the option to load the code from a file or from a Go playground URL.
Performance improvements
‘go list’ changes
When you open a project, GoLand indexes the files and runs the go list
command, which reports information about the project structure, for example, which dependencies and modules the project contains. Indexing is paused while go list
is running, and you don’t have access to code insight features until indexing is finished.
Previously, the go list
command would run twice in some cases. This happened because, after the first run, GoLand would recognize that the project had changed without being able to tell whether there were any new modules. A second go list
run was then needed to identify whether there were new modules in the project that should be checked.
We’ve changed our API, so now the IDE discovers whether new modules have appeared in the project immediately after the first time go list
is run. From now on, go list
will only be launched a second time if new modules are detected in the project.
We hope that this change will significantly improve performance for big projects with a lot of modules.
Restore project structure from cache on open
This change also concerns how GoLand indexes files and runs the go list
command.
As we already mentioned, when you open a project, GoLand indexes the files and runs go list
. While go list
is running, indexing is paused, and code insight features won’t work until it is finished.
Now, when you open a project, the information reported by go list
is saved on disk in cache memory. When you open that project again, the data about the project’s structure is loaded from memory and considered when indexing starts.
Thanks to this, indexing continues without pauses and finishes faster. go list
still needs to be launched, but it runs in the background. As a result of these changes, the code insight features are available much faster after you open the project.
Faster IDE startup and project opening
GoLand has received a number of other performance improvements designed to decrease the time it takes to launch applications and open projects in JetBrains IDEs.
Some of the processes that used to run sequentially have been parallelized. The team has also managed to reduce eager class loading and save significant time on Intention Actions, Inspections, some constants, and other extensions that were previously loaded and instantiated unnecessarily.
Nearly all project components in bundled plugins have been eliminated. As a result, overall startup performance – including editor restoration – has been improved by around 30%.
File size limit raised
We’ve raised the file size limit from 2.5 MB to 10 MB.
Code insight features, like navigation and highlighting, don’t work for files that exceed the size limit. While the 2.5 MB limit was enough for most files, there are projects with files bigger than that – for instance, the AWS SDK or GCP.
We think 10 MB will cover all the popular SDKs. If it’s not enough for you, please leave your feedback here.
That’s it for today! We’d 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. Thanks for reading!