In this release:
Key features are described below. Much of the work of this, as usual, consists of numerous small bug fixes.
We are pleased to report that crash stability has improved so much in recent years that the fraction of gopls telemetry reports clearly due to hardware failure is significant and growing.
This release includes support for a non-standard LSP feature that allows code actions to have interactive dialogs. We expect this to enable all kinds of new features, such as analyzers that prompt for additional preferences or intent, or code transformations that ask for advice on how to resolve ambiguities.
This release includes three interactive code actions:
camelCase, snake_case).Dialog support is a non-standard feature of LSP. It is currently supported only by gopls and requires a language client (such as VS Code) that supports the proposed protocol. We plan to work with the broader LSP community to develop other LSP clients (editors) and servers to refine the design and support dialogs as a standard part of the protocol.
Gopls now detects changes in the go.mod requirements. The first time gopls sees a new configuration, for example after a dependency is upgraded, it will prompt to run vulnerability scanning.
If you prefer to avoid interactive prompts, opt for “always” or “never” and your choice will be saved persistently in the user's configuration directory (beneath os.UserConfigDir).
The set of available code lenses now includes run_govulncheck by default.
vulncheck setting is now "Prompt" (see above).fieldassignment analyzer is back by popular demand, though still off by default.renameMovesSubpackages setting determines whether a package-rename operation should also move subdirectories.importsSource setting is deprecated and will be removed in the next release.-port=int debugging flag (redundant with -listen) has been removed.-listen=address flag now rejects an implicit host (e.g. :0). You must explicitly specify a host such as 0.0.0.0 or (preferably) localhostsemanticTokens setting is disabled (the default), the server no longer advertises the semantic token capability during server initialization. This prevents the client from sending unnecessary requests.require declaration will report all the imports of that module in the module defined by the go.mod file.atomictypes analyzerThe new atomictypes analyzer suggests replacing the primitive sync/atomic functions with the strongly typed atomic wrapper types introduced in Go1.19 such as atomic.Int32. The analyzer's fixes change declarations like var x int32 to var x atomic.Int32 and update corresponding call sites from atomic.AddInt32(&x, 1) to method calls like x.Add(1).
embedlit modernizerThe new embedlit modernizer suggests removing embedded field type specifiers from composite literals when they are redundant under the rules of Go 1.27, which introduces the ability to directly initialize fields promoted from embedded struct types without a nested literal.
fieldassignment analyzerThe fieldassignment analyzer, which reports diagnostics about memory layout and was disabled in v0.17.0, has been restored. It is disabled by default. (Hovering over the declaration of a struct type or its individual fields continues to reveal its size/class/offset information.)
scannererr analyzerThe scannererr analyzer reports failure to call the Err method when calling the Scan method of bufio.Scanner in a loop.
writestring analyzerThe new writestring analyzer detects inefficient string concatenation in uses of WriteString, of the form WriteString(a+b), and offers to replace them with WriteString(a); WriteString(b).
waitgroup modernizer renamed to waitgroupgoPreviously there were two analyzers named waitgroup: an analyzer that checks for misuses of sync.WaitGroup, and a modernizer that simplifies goroutine management with sync.WaitGroup. We have renamed the modernizer to waitgroupgo.
stringscut modernizer now handles Split and SplitNThe existing stringscut modernizer now replaces calls such as strings.Split(s, ":")[0] or strings.SplitN(s, ":", 2)[0] with Go 1.18‘s strings.Cut(s, ":"), which is more efficient since it doesn’t need to allocate a short-lived array.
yield analyzer improved precisionThe yield analyzer, which detects problems in iterators that fail to stop once yield() returns false, has been rewritten as a non-sparse Killdall-style monotone dataflow analysis, improving its precision.
Gopls introduces an experimental server-side file watching mechanism to monitor file system events directly. This feature supplements standard LSP file change notifications in environments or editor clients where client-side events may be unreliable or dropped.
This feature is configured via the internal setting fileWatcher, which supports three strategies:
"off" (default): the client is solely responsible for change notification"poll": the server periodically scans workspace directories, using optimizations similar to git status"fsnotify": the server uses kernel support for file-change notification. This strategy is system dependent and may need to open many directories to watch a large workspace, risking file descriptor exhaustion