Sourced from golang.org/x/tools's releases.
gopls/v0.12.0
This release contains a major rewrite of the way gopls computes and stores package information, with the goal of reducing memory usage and allowing gopls to scale to larger repositories. This change can also significantly reduce startup time when workspaces are reopened, as gopls now uses a file-based cache to persist data across sessions. With these optimizations, gopls is finally able to fully analyze dependencies using the golang.org/x/tools/go/analysis framework, resulting in improved accuracy for analysis diagnostics.
You can install this release with
go install
:go install golang.org/x/tools/gopls@v0.12.0
Support changes
As gopls matures, we're trying to simplify its configuration so that gopls Just Works in more scenarios, and so that we have fewer configuration combinations to test. This means that we will be gradually deprecating settings that affect the core behavior of gopls.
Removed experimental configuration options
As announced in the v0.10.0 release notes, this release removes support for the
experimentalWorkspaceModule
andexperimentalWatchedFileDelay
settings. TheexperimentalPackageCacheKey
setting is also removed, as it is irrelevant in the new design.The
experimentalWorkspaceModule
setting in particular may still be in use by some users. This setting has been superseded by built-in support for multi-module workspaces in thego
command, via Go workspaces. To get the equivalent behavior in gopls@v0.12.0, please create ago.work
file in your workspace using all desired modules. To use all modules in your workspace, run:go work use -r .
Dropped support for Go 1.13-1.15, deprecated support for Go 1.16-1.17
As announced in the v0.10.0 release notes, this release drops support for Go 1.13-1.15, and in fact does not build with these Go versions.
Additionally,
gopls@v0.12.x
will be the final sequence of versions supporting Go 1.16-1.17, and therefore displays a deprecation notice when used with these Go versions.Supported operating systems
Given that our users are almost entirely on Linux, Windows, or Darwin, we are discussing narrowing our support to focus on those operating systems, in golang/go#59981.
Performance improvements
The banner feature of this release is an internal redesign that significantly improves the way gopls scales in larger codebases. Performance, particularly memory usage, has long been a pain point for our users.
Reduced memory usage
Previous releases of gopls held typed syntax trees for all packages, in memory, all the time. With this release, these large data structures are ephemeral: as soon as they are constructed, an index of information derived from them is saved persistently to a file-based cache, and the data structures are recycled. The index for each package includes the locations of declaring and referring identifiers; the set of exported declarations and their types; the method sets of each interface; and any diagnostics and facts (see below) produced during analysis. The index holds all the information needed to serve global-scope LSP queries such as “references”, “implementations”, and so on.
Moving package information to a file-based cache greatly reduces the amount of RAM gopls uses, by almost an order of magnitude in larger projects. The table below shows the reductions in steady-state memory usage for three open-source Go repositories.
Project Packages In-use bytes v0.11.0 v0.12.0 Change gopls 405 497MB 232MB -53% kubernetes 3137 3090MB 832MB -73% google-cloud-go + submods 7657 5039MB 863MB -83%
... (truncated)
229f848
gopls/internal/lsp/source: enable new defers analyzer2dc7eba
go/analysis: use parser.SkipObjectResolutionf91c023
go.mod: update golang.org/x dependenciese0783a8
internal/gcimporter: remove bug report on objectpath failure75f6f9c
gopls/internal/bug: add gopls/bug telemetry counter4b271f9
gopls: add gopls/client telemetry countersd0b18e2
go/analysis/passes/copylock: fix infinite recursion5b4d426
gopls/internal/hooks: clean language version before passing to gofumpt2160c5f
gopls/internal/lsp/analysis: fix stubmethods with variadic parameters3d20bbe
internal/gcimporter: add a missing return if objectpath fails