github golang/tools gopls/v0.10.0-pre.2

latest releases: v0.21.0, gopls/v0.15.3, gopls/v0.15.3-pre.2...
pre-release19 months ago

The following release notes are for a pre-release version of gopls, to be released as gopls@v0.10.0. To install this prerelease, please run the following:

go install golang.org/x/tools/gopls@v0.10.0-pre.2

If you encounter problems with this prerelease, please file an issue at https://go.dev/issues/new.

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 gopls@v0.11.0, 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 gopls@v0.11.0:

  • experimentalWorkspaceModule (golang/go#52897): this feature has been replaced by go.work files. See our documentation for information on how to use go.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

(preview) Support for package renaming

Gopls can now rename packages, by renaming the package clause in a file:
image

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

This feature is a work in progress and has a surprising number of edge cases. Please try it out, and report your experience at golang/go#56184.

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.

image

Method information in hover

Hovering over a type now shows a summary of its methods.

image

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.

image

New diff algorithm

This version of gopls uses an entirely new diff algorithm behind the scenes. For the most part you should notice no changes, but if you do experience problems related to diffs or text edits, please report an issue and set the "newDiff" setting to "old" to revert to the old diff algorithm.

Bugfixes

This version of gopls includes several bug fixes, notably:

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!

Don't miss a new tools release

NewReleases is sending notifications on new releases.