Skip to content

Releases: golang/tools

gopls/v0.8.2

31 Mar 20:27
Compare
Choose a tag to compare

This is a small release containing bugfixes and minor improvements for Go 1.18 feature support.

New Features

Fuzz target inference

Gopls will now infer the type of Fuzz targets from preceding testing.F.Add statements.
image

Generic completion improvements

This release includes several improvements to auto-completion of generic code. For example, completion of type or function instantiation now prefers types that are in terms of the constraint type set.
image

Thanks @muirdm for these contributions.

Bugfixes

The timing of this release is primarily driven by golang/vscode-go#2121, a panic when go.work files are missing a go directive. We received enough reports of this crash to know that it was affecting a significant number of users. Thanks to all those who reported issues - your diligence helps us make gopls better!

A full list of all issues fixed can be found in the gopls/v0.8.2 milestone. To report a new problem, please file a new issue at https://go.dev/issues/new.

Thank you to our contributors!

@muirdm @hyangah @suzmue @pjweinb

gopls/v0.8.1

15 Mar 18:40
Compare
Choose a tag to compare

This is a small release to pick up some bugfixes/improvements for Go 1.18 support.

New Features

Additional editing support for go.work files

Gopls now offers editing features for go.work files: diagnostics, completion, formatting, and hover. To use these, configure your language server to set the "go.work" language ID for go.work files (VS Code does this automatically).

Diagnostics
image

Completion
image

Hover
image

More diagnostics for Fuzz tests

Gopls now provides diagnostics for mismatching calls to testing.F.Add.
image

Bugfixes

A full list of all issues fixed can be found in the gopls/v0.8.1 milestone. To report a new problem, please file a new issue at https://go.dev/issues/new.

Thank you to our contributors!

@hyangah @marwan-at-work @matloob @mvdan @pjweinb @simondrake @suzmue

gopls/v0.8.0

03 Mar 17:29
Compare
Choose a tag to compare

Go version support

Support for Go 1.18

Version 0.8.0 of gopls supports features added to Go 1.18, specifically:

  • Support for multi-module workspaces using go.work files.
  • Diagnostics for Fuzz tests.
  • Improved support for generics.

To use these features, gopls must be installed using Go 1.18. See go.dev/dl for the latest status of Go 1.18 -- as of writing Go 1.18 is not yet released, but Go 1.18 RC1 may be used.

Dropped support for Go 1.12

Version 0.8.0 of gopls no longer supports building at Go 1.12. See golang/go#50827 for more details.

New Features

go.work integration

Gopls now supports multi-module workspaces using go.work files. To use this feature, create a go.work file that includes the modules you want to work on, and then open your editor to the directory containing go.work. For more information, see the go.work reference, or the gopls documentation for multi-module workspaces.

Diagnostics for Fuzz tests

When writing Fuzz tests, gopls provides diagnostics for invalid arguments to Fuzz.
image

Improved support for generics

Honor the language version configured in go.mod

gopls now provides diagnostics for language features based on the go directive in the applicable go.mod file for a package.

For some errors related to incompatible language versions, gopls offers a quick-fix to update the go.mod Go version. (note that if the go.mod file is open, it may need to be saved in order for language version changes to take effect)
gomodedit

Improved completion with type parameters

Gopls autocompletion is improved in several contexts when using generic types.

genericvarcompl

New code action to add missing method stubs

Gopls now provides a code action to implement missing methods.

implementiface

Improved performance and accuracy for workspace symbol requests

Workspace symbols uses a new fuzzy matcher that is up to 3x faster than previous, and has improved ranking. See golang/go#50016 for more details. Note that the first time workspace symbols are requested, there may be a delay as the symbol cache is populated.

Improved gofumpt integration

Gopls now sets the language version and module path when invoking gofumpt, allowing more accurate formatting based on context.

Fixes

A full list of all issues fixed can be found in the gopls/v0.8.0 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@ansaba @dr2chase @fzipp @heschi @hyangah @marwan-at-work @matloob @msAlcantara @mvdan @pjweinb @suzmue

gopls/v0.7.5

21 Jan 16:49
Compare
Choose a tag to compare

Configuration changes

templateExtensions now defaults to []

Following feedback on the template features introduced with v0.7.4, we have made improvements to the way the active set of template files is configured. The templateExtensions setting is now empty by default, and gopls recognizes any open files with the "gotmpl" language identifier as a template file. As a result, unopened files will not be loaded as Go templates unless the templateExtensions is configured to be non-empty, but gopls will still provide template language features to any open files configured to be Go template files by the LSP client.

As always, your feedback helps make gopls better, and is greatly appreciated!

Features

New postfix completions

  • The split! completion on values of string type inserts a strings.Split snippet.
    split

  • The join! completion on values of []string type inserts a strings.Join snippet.
    join

New suggested fix for unused function parameters

The diagnostic for unused function parameters now includes a suggested fix to rename the parameter to _. This diagnostic is disabled by default, but can be enabled via the unusedparams setting in the analyses section.
unusedparam

UPDATE 2022-01-26: Final Support for Go 1.12

Due to compatibility issues, v0.7.5 will be the final gopls version to support building at Go 1.12. This is consistent with our stated goal of supporting the four most recent Go versions.

Longer term, we are planning features that will make it easier to build gopls with a recent Go version, but continue to develop projects for older Go versions. At that point we will begin to narrow our support window toward an eventual goal of supporting the two most recent Go versions. See golang/go#50825 for more details.

Fixes

A full list of all issues fixed can be found in the gopls/v0.7.5 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@pjweinb @suzmue @jba @A-UNDERSCORE-D

gopls/v0.7.4

15 Dec 16:56
Compare
Choose a tag to compare

Features

Editing support for Go template files

Gopls support for template files is now generally available. While editing files intended for use with the text/template or html/template packages, gopls can provide completion, syntax highlighting, jump-to-definition, find references, and diagnostics.

To use this feature, your editor or LSP client must be configured to activate gopls for Go template files. By default, gopls considers files ending with .tmpl or .gotmpl to be template files, though this is configurable via the templateExtensions setting. More information in the documentation.

templates3

Improved support for generic code when using the Go 1.18 beta

This release includes several bug fixes related to editing generic code, as well as many improvements to diagnostic precision when operating on type parameters. See the documentation for instructions on how to build gopls using a version of Go that supports generic code.

image

Fixes

A full list of all issues fixed can be found in the gopls/v0.7.4 milestone. To report a new problem, please file an issue at https://golang.org/issues/new.

Thank you to our contributors!

@guodongli-google @hyangah @jmesyou @pjweinbgo @ShoshinNikita @stamblerre @suzmue @timothy-king @zpavlinovic

gopls/v0.7.3

19 Oct 20:50
Compare
Choose a tag to compare

gopls/v0.7.3

Features

Exclude node_modules from the workspace by default

The directoryFilters setting now defaults to [-node_modules], since these directories never include Go code. This only applies to node_modules directories at the top level of the workspace, not arbitrary depths.

Detailed hover for runes

You will now see more information about the rune when you hover over it. For example:

Screen Shot 2021-10-19 at 4 31 31 PM

Undeclared name suggested fix for functions

The undeclaredname analyzer now offers a suggested fix for undeclared function. Depending on the surrounding code, the suggested fix will either insert a new variable declaration (as before), or a new function declaration with inferred parameters and a body that panics. For example:

Screen Shot 2021-10-19 at 4 25 30 PM

Screen Shot 2021-10-19 at 4 25 40 PM

New analyzers for generic code (only with Go 1.18)

useany: Check for constraints that could be simplified to "any"
infertypeargs: Check for unnecessary type arguments in call expressions

Explicit type arguments may be omitted from call expressions if they can be
inferred from function arguments, or from other type arguments:

func f[T any](T) {}

func _() {
	f[string]("foo") // string could be inferred
}

Fixes

A full list of all issues fixed can be found in the gopls/v0.7.3 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@chitoku-k @danp @rentziass @jhchabran @krobelus @marwan-at-work @leitzler

gopls/v0.7.2

09 Sep 17:56
Compare
Choose a tag to compare

gopls/v0.7.2

Fixes

A full list of all issues fixed can be found in the gopls/v0.7.2 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@mdempsky @muirdm @NicholasAsimov @leitzler @ShoshinNikita @suzmue

gopls/v0.7.1

04 Aug 19:07
Compare
Choose a tag to compare

gopls/v0.7.1

Features

Experimental

Support go.work files (proposal)

In order to better support the new proposal for a multi-module workspace mode (golang/go#45713), gopls has added support for go.work files. Try adding a go.work file to the root of your module (you still need to enable experimentalWorkspaceModule mode) and try out the proposal!

Use invalid metadata

Set experimentalUseInvalidMetadata to true in your settings, and gopls will reuse outdated metadata until new package metadata has been successfully reloaded. This is useful if your go.mod file is temporarily invalid. In a future release, this setting will be moved out of experimental and deleted.

Fixes

A full list of all issues fixed can be found in the gopls/v0.7.1 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@bcmills @dr2chase @dominikh @rentziass @GGCristo @jadekler Johnny Jacobs @KarthikNayak @marwan-at-work @muirdm @NicholasAsimov @OneOfOne @zyctree @leitzler @ShoshinNikita @danishprakash

gopls/v0.7.0

09 Jun 18:44
Compare
Choose a tag to compare

gopls/v0.7.0

Features

Postfix completions

Postfix completions are a new style of completions that can save you time by inserting more complex pieces of commonly-written code. All of the results end with !. This feature was added experimentally in gopls/v0.6.10 and is now enabled by default.

See this example:

ezgif-3-a82b2077ff38

New commands: List known packages and add import

These commands can be used to manually list available packages to import and then add an import to your file. They are currently not used by any known clients, but they will be made available through the Command Palette in VS Code in the next VS Code Go release.

Improvements

Memory usage

Improved trimming of the ASTs of dependency packages results in reduced memory usage, especially for projects with many dependencies. This may result in some hard-to-diagnose bugs that we're not yet aware of, so please report any surprising behavior via https://golang.org/issues/new.

Fixes

A full list of all issues fixed can be found in the gopls/v0.7.0 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@muirdm @marwan-at-work @dominikh @leitzler @OneOfOne @zyctree @ShoshinNikita @KarthikNayak @suzmue @bcmills

gopls/v0.6.11

06 May 19:41
Compare
Choose a tag to compare

gopls/v0.6.11

This release contains mainly bug fixes. A full list of all issues fixed can be found in the gopls/v0.6.11 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.

Thank you to our contributors!

@ShoshinNikita @sakateka @muirdm Will Langford @empire @justplesh @suzmue