Releases: golang/tools
gopls/v0.6.7
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
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
gopls/v0.6.6
gopls/v0.6.6
This release mostly included bug fixes and changes that are not user facing. A full list of all issues fixed can be found in the gopls/v0.6.6 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.
Thank you to our contributors!
gopls/v0.6.5
gopls/v0.6.5
Features
Show available upgrades for dependencies
gopls/v0.6.0
removed support for the code lenses that showed available upgrades for dependencies. This behavior has now been reintroduced, with an improved UI. Users must explicitly request this information by clicking the "Check for upgrades" code lens above the go.mod
file's require
block. Any module with available upgrades will be highlighted with an informational diagnostic and accepting its suggested fix will preform the upgrade.
A full list of all issues fixed can be found in the gopls/v0.6.5 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.
Thank you to our contributors!
gopls/v0.6.4
Includes fixes for https://blog.golang.org/path-security.
gopls/v0.6.3
gopls/v0.6.3
This release has a number of bug fixes and documentation improvements.
A full list of all issues fixed can be found in the gopls/v0.6.3 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.
Thank you to our contributors!
gopls/v0.6.2
Features
Shadow analyzer
This off-by-default analyzer flags shadowed variables. Learn more in the Analyzers documentation.
Experimental
New keys for the GC details "annotations"
setting
The previous keys were prefixed with "no" and meant to disable certain GC details checks, which was inconsistent with the style of our other settings maps. A warning will appear suggesting a change to the new key name, but the old settings will continue to work. Full details can be found in the annotations documentation.
Documentation
Improved documentation for available analyzers.
Improved documentation for Vim.
Fixes
Editing the go.mod
file by hand (golang/go#42529)
This issue was previously marked as resolved, but it had not actually been fixed. Package metadata will now only be invalidated when a go.mod
file is saved, so you will need to save before expecting your changes to be propagated. This should significantly reduce the number of go list
calls (and therefore CPU utilization) as you edit the go.mod
file.
A full list of all issues fixed can be found in the gopls/v0.6.2 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.
Thank you to our contributors!
@findleyr @leitzler @cuonglm @pjweinb @ainar-g @msAlcantara @ericchiang
gopls/v0.6.1
This is a patch release to fix golang/go#43234. The titles of some suggested fixes were blank, leading to a bad user experience.
gopls/v0.6.0
gopls/v0.6.0
Features
Default to -mod=readonly
In Go 1.16, the Go command will no longer modify user's go.mod
and go.sum
files automatically (https://tip.golang.org/doc/go1.16#tools). In order to match this behavior, gopls
now also uses -mod=readonly
when running the go
command. Any errors reported by the go
command will be presented with a suggested fix to make the necessary fixes to your go.mod
or go.sum
files. As a consequence, your workspace may be in a partially broken state while you have errors in your go.mod
or go.sum
file. golang/go#42266 will mitigate this, but it will likely not be resolved until February.
Not recommended: If you must opt out of this behavior, you can set the allowModfileModifications
configuration to true
.
Default to GOPROXY=off
gopls
no longer accesses the network implicitly. This should improve latency in all cases, but it also means that gopls
will no longer automatically download modules that are not found in your local module cache. The one exception is that gopls
will still download dependencies on start-up, so it will continue to work as expected if you have cloned a repository for the first time. If gopls
detects a missing module, it will offer you a suggested fix that downloads it.
Not recommended: If you must opt out of this behavior, you can set the allowImplicitNetworkaccess
configuration to true
.
Inclusion/exclusion filters for directories
gopls
now supports excluding certain directories in your workspace from analysis. This may be useful if you are only working on a subset of a large repository. Note that these filters are not propagated to the go
command, so gopls
will still load metadata for these directories, which may be expensive. Configure the included/excluded directories through the directoryFilters
setting.
Debouncing for diagnostics
Diagnostics are now reported instantly only for the packages currently being edited. Diagnostics for other packages in the workspace will now only be computed after 250 milliseconds, meaning that, if you are actively typing, gopls
will not start these more costly operations. This should significantly reduce CPU utilization. This debounce delay can be optionally configured via the experimentalDiagnosticsDelay
setting.
"Upgrade direct dependencies" code lens
In gopls/v0.5.4
, we removed the per-require "Upgrade dependency" code lens, as it was very high latency, and its UX did not meet user needs. Some users have expressed disappointment about this, so, to bridge the gap, we have separated the existing "Upgrade all dependencies" code lens into two: "Upgrade transitive dependencies" and "Upgrade direct dependencies". The first is the equivalent of running go get -u all
, while the second go get
s each of your module's requires independently. We are continuing to work on improving these features and will likely bring back the "Upgrade dependency" code lens as a suggested fix (learn more: golang/go#38339).
Support for filling a partially-populated struct
The "Fill struct" suggested fix will now be suggested for structs that have some, but not all, fields set.
Experimental
Field alignment analyzer
A new analyzer has been added to suggest reordering fields in a struct in order to achieve the optimal alignment in memory. It is still off by default, but can be enabled by adding the following to your gopls
settings:
"analyses": {
"fieldalignment": true
}
Fixes
Improvements to diagnostics tracking
Diagnostic messages were not being updated correctly when the GC details
code lens was toggled on. New handling to differentiate diagnostics by sources should have resolved this issue.
File watching for directories
gopls
now correctly handles the deletion of a directory.
Other
"codelens"
setting name changed to "codelenses"
This misspelling has now been corrected, so please update your configurations appropriately.
Disabled support for symlinks
gopls
has historically had insufficient and untested support for symlinks. We have not yet decided how to move forward with symlinks, so in the interim, we have completely disabled support for symlinks. See golang/go#42833 for more details, and please weigh in if you have opinions or suggestions.
A full list of all issues fixed can be found in the gopls/v0.6.0 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 @leitzler @jadekler @muirdm @singalhimanshu @imsodin @mengzhuo
gopls/v0.5.5
gopls/v0.5.5
This is a patch release to fix two bugs in gopls/v0.5.4
.
Fixes
Excessive reloading of packages outside of GOPATH or a module
See golang/go#42813.
File corruption with CRLF line endings and //
-style comments
golang/go#42646 was supposed to have been fixed in gopls/v0.5.4
, but it was not. golang/go#42923 was reported and fixed.
A full list of all issues fixed can be found in the gopls/v0.5.5 milestone. To report a new problem, please file a new issue at https://golang.org/issues/new.
gopls/v0.5.4
Features
Opening a project that contains a module in a subdirectory
Previously, gopls
required that you open your editor exactly at or below the module root (the directory containing the go.mod
). Now, you can open a directory that contains exactly one module in a subdirectory, and gopls
will work as expected. For details on multi-module workspaces, see below.
Removal of the granular go.mod
upgrade codelenses
Previously, we offered a code lens to suggest upgrades for each require
in a go.mod
file. In anticipation of changes that limit the amount that gopls
accesses the network, we have decided to remove and reevaluate this feature. Users had mentioned that the code lenses cluttered their go.mod
files, especially if they didn't actually want to upgrade. golang/go#38339 tracks the work to revamp this feature. An "Upgrade all dependencies" code lens should still appear at the top of your go.mod
file.
Improved error message reports
Previously, critical error messages were reported as message pop-up that would re-trigger as you type. Many users would find this annoying. We have changed the approach to show error messages as progress reports, which should be less intrusive and appear more like status bars.
Improved memory usage for workspaces with multiple folders
We are now using a coarser cache key for package type information. If you use the gopls daemon, this may reduce your total memory usage.
Experimental
Multi-module workspace support
The proposal described in golang/go#32394 is still in development and off by default. See our progress by tracking the multi-module workspace milestone and project.
Enable multi-module workspace support by adding the following to your settings:
"gopls": {
"experimentalWorkspaceModule": true,
}
With this setting, you will be able to open a directory that contains multiple modules or a directory that contains nested modules.
Give this a try if you're interested in this new feature, but please note that it is still very experimental. Please file issues if you encounter bugs.
Fixes
File corruption with CRLF line endings and /**/
-style comments
Previously, when you organized the imports in a file with CRLF line endings and multi-line comments, the formatter might output incorrect content for the file, rendering it invalid Go code. This issue has popped up a number of times, but we believe it has finally been fixed for good. If you are using Windows with CRLF line ending, please report any regressions. For full details, see golang/go#42646.
A full list of all issues fixed can be found in the gopls/v0.5.4 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 @leitzler @yangwenmai @matloob @golopot @muirdm