Sourced from golang.org/x/tools's releases.
gopls/v0.13.0
These are release notes are identical to that of gopls@v0.13.0-pre.3. Thanks to all who tested the prerelease!
go install golang.org/x/tools/gopls@v0.13.0This release fixes several bugs and mitigates a few performance regressions. It also somewhat reduces the latency and CPU cost of most operations, and includes a few small additional features.
Performance improvements
While gopls@v0.12.x drastically reduced memory usage, several operations got around 50% slower due to additional I/O reading from the filesystem and time spent decoding indexes. This release optimizes those additional operations to (in most cases) achieve parity or better with the equivalent operation in gopls@v0.11.0. Additionally, this release reduces total CPU while typing or performing common operations.
Faster code actions
This release includes a particularly large performance improvement in the evaluation of code actions (including formatting/goimports on save). In the past, there have been several reasons why this operation was expensive -- VS Code users may recognize the
getting code actions from "Go"pop-up. This release fundamentally changes the way code actions are evaluated so that almost all of the work is pre-computed. As a result, formatting and adding or removing imports on save should be much faster.Analysis performance
A notable exception to CPU performance parity with gopls@v0.11.0 is running static analysis. In this case, the additional cost incurred by gopls@v0.12.x was not a regression, but rather the cost of analyzing many more packages to enable "deep" static analysis (see "Improved static analysis" in the gopls@v0.12.0 release notes.
In smaller repositories, the cost of this additional analysis is negligible -- analysis does not run until you stop typing, and typically just re-evaluates the changed package. However, it was discovered that in large workspaces that import low-level packages with a very large API surface (such as a cloud provider SDK or proto library), certain quadratic factors involved with the encoding/decoding of analysis results can dominate the cost of analysis, and result in enormous resource consumption: overloading the CPU and exhausting all memory.
This release partially mitigates those quadratic factors, significantly reducing their cost and limiting concurrency so that they do not exhaust all resources. However, fully eliminating these factors will require additional work to fix their quadratic nature. Until that is done, analysis may continue to be costly on certain repos, especially if
"staticcheck"is enabled (because staticcheck does more deep analysis than the default set of analyzers).In the meantime, a notification is added to make you aware when analysis is slow, and provide an update on the progress of indexing "deep" analysis results. Canceling this notification will cancel the ongoing analysis, but it will resume after the next change. If you don't want to see these notifications, you can set the new
"analysisProgressReporting"setting to"false"..
New Features
Highlight deprecated symbols
Deprecated symbols and packages are now marked as such. To turn off this feature, disable the
"deprecated"analysis.
Stub methods to fix missing method errors
The
"stubmethods"refactoring is now available as a quick-fix for errors related to missing methods.Improvements to function extraction
Function extraction now puts
context.Contextparameters first in the resulting extracted function. See golang/go#60738 for details.Improvements to the embeddirective analyzer
The embed directive analyzer now verifies the location of
//go:embeddirectives, and provides a quick-fix to add missing"embed"imports.
... (truncated)
b5e55d1 go/analysis/analysistest: give better hint in SuggestedFix assertiona807ccf go.mod: update golang.org/x dependencies21090a2 gopls/internal/lsp/cache: use persistent.Set in a couple places38b898b internal/persistent: add Set44f7796 gopls: add and enable the slog analyzer2c6ba93 gopls: tidy for 1.17+5a96569 gopls/internal/lsp/cmd: don't use x/exp/slices77c6ac6 gopls/internal/telemetry: don't schedule the next upload010e045 internal/persistent: use genericsa1a928d gopls: remove dead code