Skip to content

Releases: golang/tools

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

gopls/v0.6.10

13 Apr 20:30
Compare
Choose a tag to compare

gopls/v0.6.10

Features

t.Fatal snippet

If you trigger completion in a test function, on the line after a call to a function that returns an error, you will be offered a completion snippet for:

if err != nil {
    t.Fatal(err)
}

See the example below:

Screen Shot 2021-04-13 at 4 17 41 PM

Experimental

Postfix completion snippets

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 !. Enable this feature by setting "ui.completion.experimentalPostfixCompletions": true.

See this example:

ezgif-3-a82b2077ff38

Fixes

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

Thank you to our contributors!

@marwan-at-work @soluchok @zchee @ShoshinNikita @Makima0 @muirdm @steeve

gopls/v0.6.9

19 Mar 20:32
Compare
Choose a tag to compare

gopls/v0.6.9

This is a patch release to fix golang/go#45092.

gopls/v0.6.8

17 Mar 21:39
Compare
Choose a tag to compare

gopls/v0.6.8

This is a patch release to fix golang/go#45075.

gopls/v0.6.7

16 Mar 18:53
Compare
Choose a tag to compare

gopls/v0.6.7

Features

New analyzers

The unusedwrite and nilness analyzers are now available, but they are disabled by default. Note that enabling them permanently may significantly increase memory usage. You can configure analyzers through the analyses setting.

Improved hover with time.Duration

Screen Shot 2021-03-16 at 8 33 25 AM

Hover for any constant of type time.Duration is shown both in nanoseconds and as a human-readable string.

Fixes

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

Thank you to our contributors!

@findleyr @heschik @pjweinb @hyangah @ainar-g @glepnir @ShoshinNikita @msAlcantara