While reviewing CL 592519, I had to pause to confirm that the fuzzy
matcher is only used by gopls, and so we are therefore free to change
its matching heuristics.
Move the library to the gopls module to make this relationship more
apparent.
Change-Id: I2d097fe68cfb6c83d82a09c63eddd8b7462f6ec7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/595115
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
For some reason this solution didn't occur to me in CL 512636. By
lifting this handling out of forEachPackageInternal, we simplify the
logic of type checking.
Change-Id: Ie8738d04aa5e1e4811f978f2ebe2d1cfc3b839b0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591918
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Previously the user given pattern "A" would match "Ant" and "ant"
equally well. Now it will match "Ant" better than "ant".
There already was a case sensitive match bonus, but it was combined
with a "head" character bonus, so "Ant" got the case sensitive bonus,
and "ant" got the head match bonus (and they tied).
Tweak the head match bonus to not apply if the pattern is case
sensitive. In other words, if the user is explicitly putting capital
letters in the pattern, don't give a bonus if the pattern char's case
differs from that of the candidate char.
For example, if the pattern is "Foo", the "F" no longer gets a bonus
for matching the "f" in "fooBar".
I tweaked the test to test strict relative ranking. Previously it
allowed adjacent test inputs to have the same score, but I wanted to
test that "N" matches "Name" strictly better than "name".
Fixesgolang/go#64224
Change-Id: Ibce21985d5c904167cec239d62a4f53e814a9b08
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592519
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
When completing printf calls, we previously only preferred
pointers and slices. This meant to make an interface object acceptable
for "%p", we would take its address to turn it into a pointer.
Change "%p" to also prefer interface types in addition to chan, map, and
func, which all have pointer semantics. Note that interface types
don't necessarily contain pointers, but they might, so tacking on "&"
automatically is annoying.
Fixesgolang/go#65609
Change-Id: Idf2ba9cf27fa4ea8e721396cded5a7743d79807b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593575
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This code action moves selected code sections to a newly created file within the same package. The created filename is chosen as the first {function, type, const, var} name encountered. In addition, import declarations are added or removed as needed.
Fixesgolang/go#65707
Change-Id: I3fd45afd3569e4e0cee17798a48bde6916eb57b8
GitHub-Last-Rev: e551a8a24f
GitHub-Pull-Request: golang/tools#479
Reviewed-on: https://go-review.googlesource.com/c/tools/+/565895
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Add skips as appropriate to TestFreeRefs and TestDriverConformance.
Also add a skip for a preexisting failure on wasip1: golang/go#64725.
Fixesgolang/go#68163
Updates golang/go#64725
Change-Id: I2827160bad6627755f213e4b8b54d53333d2d98d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594895
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
The builtin file represents a psuedo package for builtin documentation.
When hovering over a builtin declared in the builtin file, its
corresponding hover content should be the same as hovering at the call
site.
Fix this by intercepting hover requests originating from the builtin
file. Along the way, fix a bug that jumping to a definition in the
builtin file went to the declaring node, not declaring identifier.
For golang/go#68026
Change-Id: I070ec701cb7e067dd1cbb14a968c063169bb541c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594795
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Since it doesn't find likely mistakes, it is a poor fit for the
gopls analyzer suite: even when off-by-default, its diagnostics
can be confusing.
Instead, its docs now advise users who come across it to run
it using a standalone singlechecker as desired.
+ release note
Also, we issue a deprecated warning if the user's configuration
enables the deleted analyzer, with a reference to the 0.17
release so that users can find the release note.
Fixesgolang/go#67762
Change-Id: I7e2eafc3216df84eb62de132ac2f04e0bf444f92
Reviewed-on: https://go-review.googlesource.com/c/tools/+/590375
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
In case the import already exists the edit was be empty.
Fixes#68173
Change-Id: If0697775023ce76bc70db66a8ee9268c2b5cdd09
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594258
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Lasse Folger <lassefolger@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The package path in a /pkg URL does not want a module
version suffix: the view specifies the versions of all packages.
Remove them.
Fixesgolang/go#68116
Change-Id: Icbe7a6e7346d12456724d005fe8f755872657055
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594556
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This reverts the functional change of commit 3629652 (CL 588056) that caused
range-over-func to differ from other range operands; but we keep some tests
and tidy up the logic.
It was decided at the 11th hour to permit redundant blanks in range-over-func
statements in the go1.23 spec; see
https://github.com/golang/go/issues/65236#issuecomment-2187122281.
Fixesgolang/go#67239
Updates golang/go#65236
Change-Id: Ib3c1c535a1107a05f18732e07d7c8844bbac4d1e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594555
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
When an inline eliminates the last use of an import,
that name is available for re-use. Don't choose a worse
name when adding imports for the callee.
Fixesgolang/go#67281
Change-Id: Idb731e0d3073292c639697819236448f99b7602a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592575
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This allows us to simplify both the declaration of the enum
(particularly its doc comments) and the generator logic,
which no longer treats it as a special case.
Now that "analyses" is the only remaining special case
of map[string]bool, consolidate the two generator
hacks for it.
Change-Id: I49d4e3ca41e96d02d8444925cc013e2b19cf2305
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593616
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Like CodeLensSource, these enum values are gopls extensions (and
their configuration interface) and not part of LSP.
No change to generated files.
Change-Id: I2413fd23acc92450f1f0712f0f77a1c83674505a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593816
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I391dbba608b24220f4af37f620e5f33acbad1578
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593637
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
This change causes the "env" setting to require
that its JSON value is a mapping from strings to
strings, or int for legacy compatibility; but other
values (float, array, object, null, bool) are now
rejected.
Also, group all the deprecated settings together with
a comment to resist the temptation to delete them.
Change-Id: I7eb2f017e9cda4a3821370034b8e95809a3d8e11
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
The current implementation does not consider type conversions to be
duplicable operations; this change resolves it by handling *ast.CallExpr.
All type conversions except []byte(string) and []rune(string) are now
considered to be duplicable.
The change also removes redundant type conversions when typed constants
are passed to inlined functions.
Fixesgolang/go#67589
Change-Id: I524dbff1ae09466f56459e0bf3b6425be38d157c
GitHub-Last-Rev: 580a00aa8b
GitHub-Pull-Request: golang/tools#494
Reviewed-on: https://go-review.googlesource.com/c/tools/+/588175
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Package.Build and Program.MethodValue can create and build
Functions that may be depended on by other calls to
Package.Build and Program.MethodValue. Both of these
APIs now wait for any Functions that are shared and depended
on to finish building before returning.
This fixes some data races observed when accessing the Blocks
field of shared functions.
Functions that are members of Packages (fn.Pkg != nil)
are still always built by fn.Pkg.Build().
These dependencies can be create cycles between public API
calls that both depend on Functions the other is building.
For example, both the "net/http" and "internal/trace/testtrace"
packages both depend on slices.Contains[[]string,string] and
slices.Index[[]string, string]. Under some schedules, building
both packages may need to wait for the other package to finish
building before finishing.
This introduces a new internal type task. tasks
allows for waiting on the transitive closure of builders iterating
to be marked as done before proceedind.
Also:
- Add a test that reliably reproduces the data race.
- Refactors creator.add calls to happen after the function is created.
- Merges creator into builder.
- Updates the builder to mark when it is done building and wait
for dependencies.
- Define type unit = struct{} and clean up.
Fixesgolang/go#67079
Change-Id: I34d2b8730b19609f5fbf6b55b3db33f59818a17b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Fixesgolang/go#68041
Change-Id: I04f4f0305e2b15a6fb89809a60a6d62c7176b2a9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Fixesgolang/go#68055
Change-Id: I57c7641ab40521919053c1cb6492152e08b341c9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593316
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL defines a type for the true|false|"gopls" type used
by linksInHover, and adds a special case to the doc+api generator
to treat it as an enum, so that VS Code will present a better
value-chooser UI for it.
Also, document the type grammar used in the docs.
Updates golang/go#68057
Change-Id: I9e334fbc94dcbdc70657d8e64f67fb807e69cbf8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593656
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Contra the previous CL, we decided to store the PNG images
in git, but in a separate submodule so that we don't bloat
the gopls module download.
(These images will also be shared with forthcoming gopls
docs in CL 583316.)
Change-Id: I5bab6114ce10304725ba2ac58a8654c247171801
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593675
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The images are intentionally missing; we don't want to
bloat the repo with PNG files, so I plan to set up
a process for storing images in a blob store later
today, at which point I will update the URLs to point
there. But we can proceed with the release before that.
(Many of these images will be shared with the gopls durable
documentation slowly coming together in CL 583316.)
Change-Id: I508b13ad2ae3b77f08dfeb895472db09542661b2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593476
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This enum is properly a setting, not a protocol feature.
The .md and api.json generator script assumes that all enums
are in the settings package, and consequently emitted incorrect
names for this type.
Generator changes in detail:
- remove the package.Load of both "settings" and "protocol",
reverting part of an early change.
- remove loadAPI special case for "codelenses" not being an
enum-keyed map, as it is one. (As a consequence, the enum
values appear in api.json in alphabetical, not declaration,
order. Also, the title portion of the codelend doc string
is no longer discarded.)
- add lots of missing commentary.
This may seem like a large change at the 11th hour, but note:
- the only change to the production code is a renaming;
- the effects of the generator changes are entirely confined
to settings.md and api.json.
Fixesgolang/go#68057
Change-Id: I097f0a9b2e34b8f9a3438112b55efb2081b4acb2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593615
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Go 1.17 is long since out.
Furthermore, CL 516575 added a use of parser.SkipObjectResolution to
a file with a go1.16 build constraint. This used to be fine, but not
now that vet checks for this (see go.dev/issue/66092) since that API
is new to Go 1.17.
For golang/go#66092.
Change-Id: I749b2aa52e02308415c27028be15a436ee11d95c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/593297
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This change changes the linksInHover option from bool to
a sum of false | true | "gopls".
The "gopls" setting causes Hover(SynopsisDocumentation)
to generate links to gopls' internal web-based doc viewer.
Thanks to Hana for the idea.
+ Test, release note
Fixesgolang/go#67949
Change-Id: I384796780436b191a0711c60085d67363d00e5f6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572037
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This change causes the 'Browse documentation...' code action
to offer different pages based on the current selection:
- in an ImportSpec, or a use of the PkgName,
we display the imported package;
- in a reference to an imported symbol, we display that
symbol (except for fields, or methods of nonexported types).
The logic that computed the fragment, now extracted to
golang.DocFragment, now also computes an appropriate title.
The various cases of this function are exercised by
a new integration test.
Also, rename s/Render/PkgDoc/ in the integration tests.
Updates golang/go#67949
Change-Id: I7f4b014beca8cfde9ca3540dd10b32e1eb8f95e2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change simplifies the SetOptions machinery by
eliminating the (public) OptionsResult and Options
types and their methods, and using simpler standalone
functions of these forms:
setT(dest *T, value any) error
asT(value any) (T, error)
The code is clearer and significantly shorter.
Details:
- rename SetOptions to Options.Set.
- return only the errors, not the OptionsResults;
server.handleOptionResult renamed handleOptionErrors.
- remove error result from server.handleOptionResult,
per preexisting TODO.
- add missing doc comments.
- use JSON terminology in error messages.
Note, minor behavior changes:
- the buildFlags and directoryFilters flags now use
asStringSlice (per the preexisting TODO), and also
templateExtensions, but this replaces Sprint(x)
with asString(x), which is strictly speaking an
incompatible change.
Change-Id: Ib2169ba8e1db1a34e9bc269e6e8cef3a6763e6e6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592536
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Previously, anonymous functions were treated as nodes
in the call hierarchy view, but it doesn't make sense to
do so because we have no reliable way to find references
to them, except from within their enclosing function.
So, this change treats anonymous functions and their
enclosing functions as a single item.
Fixesgolang/go#64451
Change-Id: I3841adcbad4b13ab190fad58daf38c1bbc6f8baa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/546736
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
We decided "browse" is better than "view" (or last week's "show")
for the UI description, since it connotes "web browser".
Thanks to Dominik Honnef for the idea.
Updates golang/go#67949
Change-Id: If32be800e5c2a0fc50028aad88a00467abe10421
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592496
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Users unfamiliar with the subtleties of version support are rightly
confused by our current documentation. Try to clarify, by defining terms
more precisely and being sure to emphasize that language version support
is unchanged.
Also, add a section for the new stdversions analyzer, which is not
present in gopls@v0.15.x.
For golang/go#67936
Change-Id: Ia9f241da4a67dc0ca82532ae945751ad3c6b6f1f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592576
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
RunWithSuggestedFixes was written without a clear understanding
of what the semantics of multiple fixes should be. We believe
the only sensible interpretation is the one described here:
https://github.com/golang/go/issues/67049#issuecomment-2163687538
This change documents the interpretation at Diagnostics.SuggestedFixes,
and adds a TODO at RunWithSuggestedFixes to note that its
conflict resolution is problematic, plus a suggested workaround.
A later change will fix RunWithSuggestedFixes, or provide a
replacement if that should prove infeasible.
Updates golang/go#67049
Change-Id: I59d93d77f05e13e2458daa2d9897057ed9f82d06
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592495
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Previously, the offered fix was string(x) -> string(rune(x)),
which is not the most commonly desired change. Now, the analyzer
offers both fixes, with informative descriptions.
The Sprint fix must take care to preserve the type when it's
not exactly string. Also, it may require adding an import
of "fmt", using the new AddImport refactoring helper.
The "did you mean?" hint in the diagnostic (added by CL 235797
for golang/go#39151) has been removed, since the descriptions
of the offered fixes capture the same information, and there
was a recent editorial decision made against such hints.
Also:
- split the tests into tests of diagnostics and tests of fixes,
since the latter now need to use the clumsy golden-file-is-a-txtar
mechanism. Reduce the regexp patterns to just the minimum.
- clarify RunWithSuggestedFixes' explanation of txtar mechanism.
- clarify SuggestedFix.Message and provide an example of the
proper form.
Googlers: see b/346560254
Change-Id: I493cf675a4c71d4ee40632fc9ad47a8071eafa76
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lasse Folger <lassefolger@google.com>
Reviewed-by: Tim King <taking@google.com>
This CL defines a new helper for inserting import declarations,
as needed, when a refactoring introduces a reference to an
imported symbol.
Also, a test.
Change-Id: Icba17e6f76e67d2dad8f68b312db7111f4df817a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592277
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
It appears to be alone in using JAL instead of the CALL instruction.
Fixesgolang/go#67960
Change-Id: Ic7002caf418d0ffcf8592f1e255e6c8ea260909b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592476
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Update the v0.16.0 release notes to reflect 1.23 support and changes to
our support policy.
For golang/go#67936
Change-Id: I330b8a3897fc3b4b944eb695143042654556dbf1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/592156
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Previously, we would run an analysis when RunDespiteErrors=true only
if all package errors were syntax or type errors. We should run the
analysis on all errors.
The previous design choice was motivated by a concern that list and
unknown errors might indicate something unexpectedly wrong about the
program. If RunDespiteErrors=true, then this would go under the users'
radar.
This design choice seems somewhat arbitrary and creates problems when a
list error is a duplicate of a type error; the analysis is not
executed despite a conceptually single type error. Further, package
errors are always printed to stderr, so they are visible to users.
Lastly, we return exit code 3 if there are any diagnostics. Otherwise,
we return 1 exit code, if there are any packages errors.
Fixesgolang/go#67790
Change-Id: Ie3186a08ed3c8292033344aec35fc755a6d256f2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591117
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Change-Id: I0ab009bd9142a2be987f042632bf57713d8b31f8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591416
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
CL 589975 triggered a latent starvation bug when the findImports
operation of internal/imports was cancelled. This CL first reproduces
the starvation conditions by refactoring to isolate the algorithm in a
unit test. Then the missing select statement is added to fix the bug.
addExternalCandidates is also simplified somewhat using x/sync/errgroup.
Many thanks to hyangah@gmail.com for finding the root cause of this
starvation.
Fixesgolang/go#67923
Change-Id: Ib0a12a9a667af84150d84c3e988e460c9ae1d973
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591756
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
As reported in golang/go#67889, a short unresolved identifier can cause
goimports fixes to be quite slow, because the substring match heuristic
used to filter import paths matches a large fraction of the module
cache.
Fix this by improving the precision of the matching heuristic used to
filter potential packages. We now match only full segments of the import
path (ignoring '.' and '-'), or subsegments delimited by '.' and '-'.
Add a gopls benchmark that reproduces this initial slowness, along with
a command to force a scan of the module cache. On my (overpowered) linux
development machine, with a 5GB module cache, this change reduces the
benchmark time ~90%, from 2s to 200ms. With a smaller machine, slower
operating system, or larger module cache, I imagine the starting
point could be significantly more than 2s.
Fixesgolang/go#67889
Change-Id: Id8f7ea20040b059b42366333adeb4add684dee61
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reorganizes how type substitution is done for Named types.
This fixes several issues with Named types support for
parameterized types defined within parameterized functions.
Additionally supports recursive substitution of a type parameter
that is not a type parameter being substituted.
Fixesgolang/go#66783
Change-Id: I31478e622e854d58620687c1964cf8b254bf419f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/581835
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The function StmtToInsertVarBefore on getting a
variable declaration in switch stmt was returning
the variable declaration statement instead of the
switch statment.
Fixesgolang/go#67905
Change-Id: Ied1f82061ae4d5bbe6b65e6897e8db44ef43d8c6
GitHub-Last-Rev: 11b8c6d043
GitHub-Pull-Request: golang/tools#498
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591496
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
...like we do for Unmarshal.
Change-Id: I2c7ee1f817002c747c429c3fbfb79df3a5cd1a4d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591955
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
All three should be consistent, and "View" connotes a separate
surface more than "Show", which connotes adding annotations to
the current editor view.
Also, rephrase assembly template to encourage upvoting of
the relevant VS Code issue.
Change-Id: I99b07ba347e2023bd672e2b34b13faeece4108db
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Thanks to @ct16k for reporting the crash and suggesting the fix.
Also, a test.
Fixesgolang/go#67915
Change-Id: I72472603e52831d5e571cb8a4e053fd15ff49b72
Reviewed-on: https://go-review.googlesource.com/c/tools/+/591615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>