This release contains significant performance improvements (especially in incremental processing after source changes), bug fixes, and support for the LSP “inlay hints” feature, along with several other minor enhancements.
Performance improvements
Source edits cause gopls to invalidate and recompute information about the workspace, most of which has not changed. Previously, gopls would spend significant CPU copying data structures, sometimes more than 100ms per keystroke in a large workspace. This release includes many optimizations to avoid copying data needlessly, including a new map representation to achieve copying in constant time. Special thanks to @euroelessar for the design and implementation of this data structure.
As a result of these improvements, gopls should be more responsive while typing in large codebases, though it will still use a lot of memory.
Time to process a change notification in the Kubernetes repo:
New Features
Inlay hints
Added support for displaying inlay hints of composite literal field names and types, constant values, function parameter names, function type params, and short variable declarations. You can try these out in the vscode-go nightly by enabling inlay hints settings.
Package References
Find references on package foo
now lists locations where the given package is imported.
Quick-fix to add field names to struct literals
A new quick fix adds field names to struct literals with unkeyed fields.
Bug fixes
This release includes the following notable bugfixes:
- Fixes for goimports performance and correctness when using a go.work file (#52784)
- Fix a crash during renaming in a package that uses generics (#52940)
- Fix gopls getting confused when moving a file from the
foo_test
package tofoo
package (#45317)
A full list of all issues fixed can be found in the gopls/v0.9.0 milestone.
To report a new problem, please file a new issue at https://go.dev/issues/new.
Thank you to our contributors!
Thank you for your contribution, @alandonovan, @euroelessar, @findleyr, @hyangah, @jamalc, @jba, @marwan-at-work, @suzmue, and @dle8!
What’s Next?
The next planned gopls release is v0.9.1. We’re excited about features and improvements on the horizon, for example:
- Improved startup performance
- More accurate static analysis from fully analyzing packages outside of the workspace
- Stress testing and reliability improvements