Releases: golang/tools
gopls/v0.10.0
This release contains initial support for standalone packages and package renaming. Please see below for more details.
We are also changing our release policy to better align with semver.
Support changes
This version of gopls contains changes to our release policy, deprecates support for some older Go versions, and deprecates support for several experimental features.
New release policy
As described in golang/go#55267, we are tightening our release policy to better follow semver, increase stability, and reduce release-related toil. Significant new features will only be introduced in *.*.0
patch versions, and subsequent patch releases will consist only of bugfixes. For example, this version (v0.10.0) introduces several new features, described below. Subsequent v0.10.* releases will contain only bugfixes.
Final support for Go 1.13-1.15
Consistent with the above release policy and our stated support window, the v0.10.*
minor version will be the final set of releases to support being used with Go 1.13-1.15. See golang/go#52982 for details.
Gopls will pop up a warning if it resolves a version of the go
command that is older than 1.16. Starting with [email protected], gopls will cease to function when used with a go
command with a version older than 1.16.
Deprecated experimental features
The following experimental features are deprecated, and will be removed in [email protected]:
- experimentalWorkspaceModule (golang/go#52897): this feature has been replaced by
go.work
files. See our documentation for information on how to usego.work
files to work on multiple modules. - experimentalWatchedFileDelay (golang/go#55268): LSP clients should instead be responsible for buffering
workspace/didChangeWatchedFiles
notifications. - experimentalUseInvalidMetadata (golang/go#54180): we are going to focus instead on improving diagnostics for broken workspaces.
New Features
Support for "standalone packages"
Gopls now recognizes certain files as "standalone main packages", meaning they should be interpreted as main packages consisting of a single file. To do this, gopls looks for packages named main
containing a single build constraint that matches one of the tags configured by the new standaloneTags
setting.
This enables cross references and other features when working in a file such as the example below that contains a //go:build ignore
build constraint.
(preview) Support for package renaming
This version of gopls contains initial support for renaming packages (golang/go#41567). This is a work in progress and has a surprising number of edge cases. Additionally, this feature depends heavily on LSP client behavior: renaming a package involves moving the underlying package directory, which may behave differently in different editors. Please try it out, and report your experience at golang/go#56184.
To rename a package, initiate a rename request on the package clause of a file in the package:
When this renaming is applied, gopls will adjust other package files accordingly, rename the package directory, and update import paths referencing the current package or any nested package in the renamed directory.
Method information in hover
Hovering over a type now shows a summary of its methods.
Support for Go 1.19 doc comment syntax
This version of gopls supports the new doc comment syntax added in Go 1.19. See https://go.dev/doc/comment for more details.
New diff algorithm
This version of gopls uses an entirely new diff algorithm behind the scenes, to compute the text edits that gopls sends to the LSP client. We hope that this fixes a number of bugs in the old diff implementation, but for the most part you should not notice any effect of this change. If you do experience problems related to text edits, please report an issue and set the "newDiff"
setting to "old"
to revert to the old diff algorithm.
Configuration changes
This release changes the default value of the "directoryFilters"
setting from ["-node_modules"]
to ["-**/node_modules"]
, following support for wildcard syntax.
Bug fixes
This version of gopls includes several bug fixes, notably:
- golang/go#43144: find references doesn't always search tests
- golang/go#54816: extract function action doesn't work if the first line is a comment
- golang/go#55293: textDocument/definition is slow in large codebase
A full list of all issues fixed can be found in the gopls/v0.10.0 milestone.
To report a new problem, please file a new issue at https://go.dev/issues/new.
Thank you to our contributors!
@adonovan, @brianpursley, @findleyr, @hyangah, @pjweinbgo, @suzmue, and @dle8!
gopls/v0.10.0-pre.2
The following release notes are for a pre-release version of gopls, to be released as [email protected]. To install this prerelease, please run the following:
go install golang.org/x/tools/[email protected]
Note: These changes have since been released as [email protected]. Please see the release notes for that version for more information.
gopls/v0.9.5
This release updates the gopls vulncheck command (which backs the preview of vulncheck integration in VS Code) with the latest schema of the Go vulnerability database. See the Vulnerability Management for Go blog post for more context.
Additionally, this release includes a bugfix for redundant reloads following go.mod changes (golang/go#54473).
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.