MyGit

gopls/v0.13.0

golang/tools

版本发布时间: 2023-07-31 22:01:14

golang/tools最新发布版本:gopls/v0.16.2(2024-09-06 01:01:04)

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.0

This 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". image.

New Features

Highlight deprecated symbols

Deprecated symbols and packages are now marked as such. To turn off this feature, disable the "deprecated" analysis.

image

Stub methods to fix missing method errors

The "stubmethods" refactoring is now available as a quick-fix for errors related to missing methods. image

Improvements to function extraction

Function extraction now puts context.Context parameters 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:embed directives, and provides a quick-fix to add missing "embed" imports. image

Bug fixes

In addition to the performance fixes listed above, this release fixes a couple crashes. A full list of all issues fixed can be found in the gopls/v0.13.0 milestone. To report a new problem, please file a new issue at https://go.dev/issues/new. Please don't tolerate bugs.

What's next

Though we will continue to treat performance as a high priority, we believe this release addresses most unresolved issues related to the scalability improvements of gopls@v0.12.x, with the notable exception mentioned above of allowing robust static analysis to scale to the largest repositories. If you continue to have performance problems, please file an issue.

Our next focus will be on reducing the complexity of setting up your workspace. As much as possible, gopls should "just work" when you open a Go file, independent of your configuration or which directories you have open.

Thank you to our contributors!

@adonovan @bcmills @cuishuang @cuonglm @dmitshur @hyangah @jba @lfolger @pjweinb @rsc @timothy-king @vikblom @vikstrous2

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-07-31发行的版本