Skip to content

Releases: golang/tools

gopls/v0.4.4

03 Aug 14:20
Compare
Choose a tag to compare
  • Support for opening a single file. Previously, gopls required you to open an entire directory.
  • Support features and diagnostics for the entire module, even when you open a subdirectory of the module.
  • Extract a selected range to a variable or to a function. This feature is still relatively new, so please report issues if you encounter any. (@joshbaum)
  • Fillstruct performance improvements. It is now enabled by default again. (@joshbaum)
  • Improvements in go.mod diagnostic error presentation.

A full list of all issues closed is available in the gopls/v0.4.4 milestone.

gopls/v0.4.3

08 Jul 18:54
Compare
Choose a tag to compare

Disable the fillstruct analysis by default.
We recently uncovered some performance issues with the analysis, leading us to disable it by default.
Once those issues are resolved, we will enable it by default again.
You can still enable it by adding the following to your VS Code settings:

"gopls": {
	"analyses": {		
		"fillstruct": true,
	}
}

gopls/v0.4.2

01 Jul 14:06
Compare
Choose a tag to compare
  • Significant memory improvements (@heschik). Dependency test variants and vendored packages are no longer considered "workspace packages".
  • Smart autocompletion for "append" (@muirdm).
  • A "fill struct" code action to suggest populating a struct literal with default values (@luciolas, @joshbaum).
  • Better cgo support with Go 1.15 (@heschik). Learn more: golang/go#35721 (comment).
  • Code lens to run Go tests directly in the editor (@martskins). Currently opt-in:
"gopls": {
    "codelens": {
        "test": true,
    }
}
  • Improved folding in composite literals (@joshbaum).
  • Pop-up suggestion to run go mod vendor when inconsistent vendoring detected (@stamblerre).
  • Respect GOPRIVATE for all document links and links on hover (@findleyr).
  • A full list of issues resolved in this release can be found in the gopls/v0.4.2 milestone.

gopls/dev.go2go: You can use the new go2go prototype with gopls. See golang/go#39619.

gopls/v0.4.1

01 Jul 16:42
Compare
Choose a tag to compare

This release contains mostly stability improvements and smaller bug fixes. A list of all of the issues fixed in this release can be found in the gopls/v0.4.1 milestone. A notable change is that type error analyzers (fillreturns, undeclaredname, unusedparams, nonewvars) are now on by default.

gopls/v0.4.0

01 Jul 16:24
Compare
Choose a tag to compare
  • Improved support for working with modules (@ridersofrohan). A detailed walk-through of the new features can be found here. A quick summary:
    • Use the -modfile flag to suggest which modules should be added/removed from the go.mod file, rather than editing it automatically.
    • Suggest dependency upgrades in-editor and provide additional language features, such as formatting, for the go.mod file.
  • Inverse implementations (@muirdm). "Go to implementations" on a concrete type will show the interfaces it implements.
  • Completion improvements (@muirdm). Specifically, improved completion for keywords. Also, offer if err != nil { return err } as a completion item.
  • Jumping to definition on an import statement returns all files as definition locations (@danishprakash).
  • Support for running go generate through the editor, via a code lens (@marwan-at-work).
  • Command-line support for workspace symbols (@daisuzu).

Opt-in:

  • Code actions suggesting gofmt -s-style simplifications (@ridersofrohan). To get these on-save, add the following setting:
"[go]": {
	"editor.codeActionsOnSave": {
		"source.fixAll": true,
	}
}
  • Code actions suggesting fixes for type errors, such as missing return values (goreturns-style), undeclared names, unused parameters, and assignment statements that should be converted from := to = (@ridersofrohan). Add the following to your gopls settings to opt-in to these analyzers. In the future, they will be on by default and high-confidence suggested fixes may be applied on save. See additional documentation on analyzers here.
"gopls": {
	"analyses": {
		"fillreturns": true,
                "undeclaredname": true,
                "unusedparams": true,
                "nonewvars": true,
	}
}
  • Further improvements in the support for multiple concurrent clients (@findleyr). See #34111 for all details.

For a complete list of the issues resolved, see the gopls/v0.4.0 milestone.

gopls/v0.3.4

01 Jul 16:41
Compare
Choose a tag to compare

gopls/v0.3.3

01 Jul 16:40
Compare
Choose a tag to compare
  • Support for workspace symbols. (@daisuzu)
  • Various completion improvements, including fixes for completion in code that doesn't parse. (@muirdm)
  • Limit diagnostic concurrency, preventing huge spikes in memory usage that some users encountered. (@heschik)
  • Improved handling for URIs containing escaped characters. (@heschik)
  • Module versions from "go list" in pkg.go.dev links. (@ridersofrohan)
  • Upgrade module dependencies via a code lens on go.mod files. (@ridersofrohan)

Opt-in:

gopls/v0.3.2

01 Jul 16:38
Compare
Choose a tag to compare
  • fatih/vim-go#2701: Fix a crash in references on builtin symbols.
  • golang/go#37104: Fix crash in completion of recursive pointer types (for example, type foo *foo).
  • golang/go#37108: Fix handling of build flags in imports code.
  • golang/go#34955: Import organization was corrupting file contents for untracked files. This is now fixed.
  • CL 219203: Disable nilness analyzer. This is the only analyzer that requires go/ssa, which is expensive to compute. If you are still seeing excessive memory usage with gopls/v0.3.2, please read golang/go#36943 and open a new issue.

gopls/v0.3.1

01 Jul 16:37
Compare
Choose a tag to compare
  • golang/go#36975: Handle nil pointer in builtin packages if workspace load fails.
  • golang/go#36999: Fix panic on files that contain % in their paths.
  • Fix memory leak caused by autocompletion (CL 217677). Users were seeing huge memory usage over long sessions. Please comment on #36943 if you're still seeing this issue with gopls/v0.3.1.

gopls/v0.3.0

01 Jul 16:34
Compare
Choose a tag to compare

Note: gopls now loads your entire workspace, where “workspace” is directory you opened in your editor.

In module mode, you must open your module root (directory containing the go.mod file) or a subdirectory.

In GOPATH mode, you must open your GOPATH/src or a directory within it. If you have a large GOPATH and you open your GOPATH as your workspace root, gopls may be very slow to load. Please see #36899 for further information.

  • Autocompletion from unimported packages is on by default. You will get completions for something like fmt.Printf even if “fmt” isn’t imported yet. (@heschik)
  • Workspace-scoped references, rename, and go to implementation. These features use your workspace root as the search scope, so behavior will vary based on the directory you open in your editor. This may result in unexpected behavior. (@muirdm, @matloob)
  • Workspace-wide diagnostics. You will now see errors in your entire workspace, rather than just in your currently open files. Analysis errors will only be shown for packages with currently open files.
  • Watch file changes on disk. This allows users to switch branches without reloading their editors. Also, changing configurations no longer requires an editor reload.
  • GOPATH vendoring is fully supported. Previously, some features would ignore vendor directories, causing errors if packages weren't in GOPATH. (@heschik)
  • New autocompletion suggestions for type conversions. Improved completions for literal candidates and variadic functions. Better rankings, including rankings for builtin functions and keywords. (@muirdm)
  • Highlighting improvements: Highlighting now applies not only to variables, but also to fields, methods, types, and imports. Additional highlighting helps visualize control flow in loops and functions. Highlighting of single character variables has better support. (@ridersofrohan)
  • Documentation on hover includes links to pkg.go.dev for exported symbols. (@Southclaws)
  • Improved support for cgo dependencies. All features now work for packages that have cgo dependencies. Authoring cgo packages is still not supported, but improvements are scheduled for Go 1.15 (see #35721). (@heschik)
  • Deep completions are now on by default. This feature of completion will search the fields and methods of all available candidates to see if there are any more candidates with the expected type. As an example, say you have imported the context package and are calling a function that takes a context.Context as a parameter. In the case that you don’t have a variable of that type in scope, deep completions will suggest context.Background() and context.TODO(). (@muirdm)

Opt-in:

  • staticcheck analyses remain opt-in and can be enabled by setting "staticcheck": true in your gopls settings.
  • Go 1.14 will support running the go command without modifying the user’s go.mod file. This new feature is used in gopls to show diagnostics and suggest edits in a user’s go.mod file rather than change the file without the user noticing. Currently, gopls will suggest removing unused dependencies and warn the user if there is a parse error in the go.mod file. Enable this behavior by using the go1.14 beta and setting "tempModfile": true in your gopls settings. (@ridersofrohan)