Releases: golang/tools
gopls/v0.9.4
This release fixes an unfortunate bug in a new vet
analysis in the [email protected] release. Specifically, a stray print statement in a new analyzer for the invalid time format string "2006-02-01"
, which corrupts gopls' communication over STDIN/STDOUT.
This only affects projects using that bad format string, and only when a file in the affected package is open. Thanks to @Phadin for accurately identifying this bug so quickly after it was introduced. Issue golang/go#54459 tracks our follow-up to prevent similar regressions from making it into future gopls releases.
On a positive note, here is the new vet analysis in action. Clearly it will catch real bugs!
gopls/v0.9.3
Move fast and fix things... it appears that v0.9.2 exposed a latent crasher in gopls (golang/go#54395). This crash occurs when a new workspace is incorrectly configured, and so is likely to be rather confusing for new users. On that basis, the fix warranted a patch release.
As always, thank you for filing issues!
gopls/v0.9.2
This release contains many bug fixes, particularly related to problems that would require restarting gopls.
Note about network usage: among these fixes was a change to allow network usage when reloading the workspace. Reloading occurs when a go.mod
, go.sum
, or go.work
file changes on disk. In the past, gopls would only allow network during the first workspace load. This resulted in confusing behavior when, for example, a new dependency is added to a go.mod
file and gopls could not load it, but loading succeeded on restart. See #54069 for more details.
Configuration changes
directoryFilters at arbitrary depth
The "directoryFilters"
setting now supports excluding directories at arbitrary depth, using the **
operator. (note that for v0.9.2, the default value for this setting is still ["-node_modules]"
. In the next release, this will change to ["-**/node_modules"]
).
Bug fixes and Performance improvements...
This release contains the following notable bug fixes / performance improvements:
- Additional change optimization - Following up on the work to optimize change processing from the v0.9.0 release, this release contains additional optimizations that result in around 50% faster change processing (measured via edits in the Kubernetes repo).
- Fix for a long-standing memory leak - #53780 fixed a long-standing bug that caused gopls to hold on to its initial state, gradually leaking memory as state changed during the editing session.
- Fewer restarts - This release contains many fixes for cache-invalidation bugs that would cause gopls to get confused and require restarting. Additionally, see the note at top about enabling the network when reloading the workspace. We believe we are close to our goal that restarting gopls should never be required to fix workspace errors. If you encounter such a bug, please file an issue!
A full list of all issues fixed can be found in the gopls/v0.9.2 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, @antoineco, @dle8, @euroelessar, @findleyr, @hyangah, @jamalc, @mssdvd, @pjweinbgo, @rentziass, and @suzmue!
What's next
The next planned gopls release is v0.10.0. Weβre excited about features and improvements on the horizon, for example:
gopls/v0.9.1
This release fixes a regression in the v0.9.0 release: a crash when running the go:generate
codelens (golang/go#53781).
Thank you to all those who filed crash reports, and apologies for the breakage!
[email protected]
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
gopls/v0.8.4
This release contains fixes for a few crashes, minor performance improvements, and a couple of small new features. See below for details.
See "What's Next" for a preview of what the team is working on.
New Features
New analyzer for //go:embed
comments
Gopls now includes an analyzer for go:embed
comment directives. At the moment, this analyzer checks that the "embed" import is present, but more analyses are planned for the future. See golang/go#50262 for more information.
Improved hover for imports
Hovering over an imported path now gives you the full package doc.
Final support for Go 1.13
Per our support window, gopls v0.8.4 will be the final gopls release to support being built with Go 1.13. See golang/go#52982 for details.
Bugfixes and Performance improvements
- Faster symbol indexing. Gopls builds a symbol index the first time symbol search is invoked. That indexing should be 3-4x faster with this release.
- Improved metadata invalidation (AKA fewer restarts). v0.8.4 fixes a couple of bugs that lead to gopls getting confused about packages and needing to be restarted. We're aware of more bugs of this nature, but are working on eliminating the need to ever restart gopls.
A full list of all issues fixed can be found in the gopls/v0.8.4 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 contributions, @alandonovan, @ansaba, @findleyr, @hyangah, @marwan-at-work, @muirdm, @suzmue, and @dle8!
What's next?
The next planned gopls release is v0.9.0
. We're excited about features and improvements on the horizon. For example:
- improved go.work support. With
go.work
files, Go 1.18 fundamentally changed the way we define workspaces. We're working on expanding our support to better integrate with theGOWORK
environment variable, vendoring, and thedirectoryFilters
setting, and to help users better understand how to configure their workspace. - performance improvements. Performance continues to be a major pain point for our users. We're working on reducing CPU usage while editing. We're also laying the foundation for better indexing to reduce our memory footprint.
- package renaming. We're working on golang/go#41567, to support renaming a package via the textDocument/rename request.
As always, thank you for filing issues and feature requests. Your feedback helps us improve!
gopls/v0.8.3
This release exists primarily to pick up [email protected], which supports generics.
New Features
Gopls now integrates with [email protected], which supports generics. To enable staticcheck analyzers, set "staticcheck": true
in your gopls settings. Note that as part of this change, staticcheck is only supported when gopls is built with Go 1.17+.
Bugfixes
A full list of all issues fixed can be found in the gopls/v0.8.3 milestone. To report a new problem, please file a new issue at https://go.dev/issues/new.
Thank you to our contributors!
gopls/v0.8.2
This is a small release containing bugfixes and minor improvements for Go 1.18 feature support.
New Features
Fuzz target inference
Gopls will now infer the type of Fuzz
targets from preceding testing.F.Add
statements.
Generic completion improvements
This release includes several improvements to auto-completion of generic code. For example, completion of type or function instantiation now prefers types that are in terms of the constraint type set.
Thanks @muirdm for these contributions.
Bugfixes
The timing of this release is primarily driven by golang/vscode-go#2121, a panic when go.work
files are missing a go
directive. We received enough reports of this crash to know that it was affecting a significant number of users. Thanks to all those who reported issues - your diligence helps us make gopls better!
A full list of all issues fixed can be found in the gopls/v0.8.2 milestone. To report a new problem, please file a new issue at https://go.dev/issues/new.
Thank you to our contributors!
gopls/v0.8.1
This is a small release to pick up some bugfixes/improvements for Go 1.18 support.
New Features
Additional editing support for go.work files
Gopls now offers editing features for go.work
files: diagnostics, completion, formatting, and hover. To use these, configure your language server to set the "go.work" language ID for go.work
files (VS Code does this automatically).
More diagnostics for Fuzz tests
Gopls now provides diagnostics for mismatching calls to testing.F.Add
.
Bugfixes
A full list of all issues fixed can be found in the gopls/v0.8.1 milestone. To report a new problem, please file a new issue at https://go.dev/issues/new.
Thank you to our contributors!
@hyangah @marwan-at-work @matloob @mvdan @pjweinb @simondrake @suzmue
gopls/v0.8.0
Go version support
Support for Go 1.18
Version 0.8.0 of gopls supports features added to Go 1.18, specifically:
- Support for multi-module workspaces using
go.work
files. - Diagnostics for Fuzz tests.
- Improved support for generics.
To use these features, gopls must be installed using Go 1.18. See go.dev/dl for the latest status of Go 1.18 -- as of writing Go 1.18 is not yet released, but Go 1.18 RC1 may be used.
Dropped support for Go 1.12
Version 0.8.0 of gopls no longer supports building at Go 1.12. See golang/go#50827 for more details.
New Features
go.work
integration
Gopls now supports multi-module workspaces using go.work
files. To use this feature, create a go.work
file that includes the modules you want to work on, and then open your editor to the directory containing go.work
. For more information, see the go.work
reference, or the gopls documentation for multi-module workspaces.
Diagnostics for Fuzz tests
When writing Fuzz tests, gopls provides diagnostics for invalid arguments to Fuzz
.
Improved support for generics
Honor the language version configured in go.mod
gopls now provides diagnostics for language features based on the go
directive in the applicable go.mod
file for a package.
For some errors related to incompatible language versions, gopls offers a quick-fix to update the go.mod
Go version. (note that if the go.mod
file is open, it may need to be saved in order for language version changes to take effect)
Improved completion with type parameters
Gopls autocompletion is improved in several contexts when using generic types.
New code action to add missing method stubs
Gopls now provides a code action to implement missing methods.
Improved performance and accuracy for workspace symbol requests
Workspace symbols uses a new fuzzy matcher that is up to 3x faster than previous, and has improved ranking. See golang/go#50016 for more details. Note that the first time workspace symbols are requested, there may be a delay as the symbol cache is populated.
Improved gofumpt integration
Gopls now sets the language version and module path when invoking gofumpt, allowing more accurate formatting based on context.
Fixes
A full list of all issues fixed can be found in the gopls/v0.8.0 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.
Thank you to our contributors!
@ansaba @dr2chase @fzipp @heschi @hyangah @marwan-at-work @matloob @msAlcantara @mvdan @pjweinb @suzmue