ast.RangeStmt.Range has been available since 1.20.
Change-Id: Ia3f9b3075d39c6415e20dfdb3151e94fbf11a597
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This makes it so that 'go install golang.org/x/tools/cmd/gorename@latest'
will continue to work. ('go install pkg@version' does not allow
replace directives.)
Updates golang/go#69360
Change-Id: I46a16a5d8dc7d1d1cf6c428388484e27f266f4e2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614635
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>
Too bad I didn't include refactor/{rename,importgraph}
in the current proposal; they will need another.
Updates golang/go#69360
Change-Id: I8af544515893a0663621a19768adf64798c93671
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614159
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
gorename is deprecated.
(Use gopls's Rename RPC or rename command instead.)
Once this module is tagged, we will delete it.
Clients will be able to use only the last version.
Updates golang/go#69360
Change-Id: I89ea5feade02f9fb15c7244847810f3c2261f7ff
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614158
Auto-Submit: 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>
And other minor tweaks.
Change-Id: Ic16024cb2630d4ba144ead38856595ea8f6d81dd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614178
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>
Reported originally in CL 611915 (vscode-go PR 3529).
And ran golangci-lint misspell checker to find a couple more.
Change-Id: I2dac2901191cc8759f0bd6b2084b61dbba174dd6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614156
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Change-Id: I6ae61513717bac0bd756b612f0a843d55f1df296
GitHub-Last-Rev: 734464cdb3
GitHub-Pull-Request: golang/tools#520
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613159
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The various command.NewXXXCommand functions all used to return
an error in case argument marshalling failed. However, in 100%
of cases, the particular argument types have infallible JSON
marshalling. This change emits the error handling code only
in the fallible cases (none yet).
Also, the New functions now return a pointer to a Command,
(as they should), simplifying surrounding logic.
(This is a preparatory cleanup for CL 612495.)
Change-Id: I2dac9f84034c2fade2ca05adc62129afc78e1cfe
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613263
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Remove the outdated normalizer for formatting interface{} as
any during tests.
* another benefit is we remove the un-exported test function from
example, it's clearer for pkgsite and godoc users.
Change-Id: Ibc0513e7487a278b1275de804aa8bd3b444a5496
GitHub-Last-Rev: 40157a9970
GitHub-Pull-Request: golang/tools#522
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613161
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>
Change-Id: I96badb1a6c4f3737a30e3a5fc5c458a1a64264bf
GitHub-Last-Rev: 9a332833af
GitHub-Pull-Request: golang/tools#519
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613158
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Use slices.Clone instead of copy now that x/tools uses Go >= 1.22.
Resolves an outstanding TODO.
Change-Id: Ia87f18e5e51f35dda5056538b9d0d0699c514ffc
GitHub-Last-Rev: 468e40586d
GitHub-Pull-Request: golang/tools#523
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613835
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Update a counter each time we observe a gopackages driver in
use. This will help us understand the conditions that led to
some crashes reported by telemetry.
Updates golang/go#60890
Change-Id: Ieca522c22b6f5bc9756210627bba82934946eaf8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/594955
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>
The new BenchmarkPackages test is failing on the perf builder, because
the gopls.packages command is not supported by gopls@v0.11.0. By
convention, skip this benchmark with -short to filter it out from the
set of benchmarks run by x/benchmarks.
Change-Id: I5e6cc22212644be0a4fc2e6d8f4ce0f282330e00
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613718
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
For larger repositories, a significant amount of time in the importer is
spent building the import map.
While we don't really want to persist these import maps, which can be
quite large, we can largely eliminate their cost by doing an incremental
breadth-first search of dependencies for the desired import path: most
imports are direct or found within a shallow search starting from the
original package.
As one reference point, the DiagnoseChange/kubernetes benchmark went
from 10% of CPU spent in importMap, to ~0% in importLookup.
Change-Id: I219aa6b7d41dfb11ec5d8a5e3819adc46dd37f2d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613715
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Adds a global to allow for disabling the new constant format string
for Printf calls. This is to allow for easier staged upgrades of
x/tools.
Change-Id: I5dc0d88cf6328a68e8994010e388366102afc892
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613655
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The isTerminal implementation works for our dev machines,
{darwin,linux} x {amd64,arm}, and avoids a dependency
on x/term, which gopls so far doesn't need... though I
am now tempted to find a pretext for the dependency.
Change-Id: If96b5cf737c9ea998d0612dec294295a5528b22a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613575
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>
This CL adds support for jumping to the definition of a function
implemented in assembly. The first Definition query jumps to the
Go declaration, as usual; this func has no body. Executing a
second Definition query jumps to the assembly implementation,
if found.
+ Test, doc, relnote
Fixesgolang/go#60531
Change-Id: I943a05d4a2a5b6a398450131831f49cc7c0754e4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612537
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL introduces an expression language for matching
stacks, inspired by watchflakes. Each issue has a block
at the start of its body of this form:
```
#!stacks
"bug.Reportf" && "golang.Hover:+19"
```
where the expression is a sentence of this grammar:
expr = "string literal"
| ( expr )
| expr && expr
| expr || expr
| ! expr
A string literal implies a substring match against
a stack trace; the other forms are boolean operations.
The stacks command reads all such predicates at start,
and uses them to associate new stacks with existing
issues. (It reports an error if a stack is claimed by
two issues.) For each claim, it updates the issue
by adding a comment describing all the new stacks
(example: https://github.com/golang/go/issues/60890#issuecomment-2350023305)
and it adds/updates the "Dups: " list on the last
line of the issue body (first comment).
This should greatly reduce the amount of toil in
associating stacks with issues, since we can just
tweak the predicates to accommodate minor variations.
The GitHub auth token now needs R/W access to golang/go issues.
Fixesgolang/go#65963
Change-Id: I836cd89bba456826839a389271ac38745e493a54
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613215
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1. There were three early returns in the frame -> URL
computation, though it was hard to see, and their
formatting logic differed. This CL factors them,
extracting the frameURL function.
2. When git clone fails (e.g. due to no SSO cert),
we failed to clean up the empty dir, causing a
persistently stuck failure state. Now we attempt
to clean up the directory. (This won't help when
the program is terminated from without.)
Change-Id: I0f7e2dd26b95899ec85b3e4666def374dc8caadd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/613076
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Since CL 612055 var GofumptFormat can never be nil, and since CL 609655
it is a very simple wrapper.
Remove it, and use mvdan.cc/gofumpt/format directly in internal/golang.
Note that this removes some documentation bits about gofumpt options, but
those are already described in internal/golang.Format inline comments.
Change-Id: Ic7d5b8412e913f2dbbc14befb978f8a4f743334a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611844
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
watchflakes reported additional test cases for TestTypeparamTest on
wasm. Skipping the test when on wasm.
Fixesgolang/go#69410Fixesgolang/go#69409
Change-Id: Icfe5da007bf7411e9875313bc1b190751f1c1a15
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612855
Commit-Queue: Tim King <taking@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
This CL causes the stacks command to mark up each stack as a
set of links to CodeSearch. In order to do that, it needs to
build the gopls executable at the correct version of gopls and Go
and for the right GOOS and GOARCH, read the pclntab out of the
executable (which is the only authority on how to decode the
symbol names that appear in the stack counter), and then
construct CodeSearch URLs from (version, file, line) triples.
The expensive steps are cached in /tmp/gopls-stacks so that they
are paid infrequently in a typical stacks run.
See https://github.com/golang/go/issues/67288 for an example
of the updated output.
Fixesgolang/go#64654
Change-Id: If1c3e42af5550114515b47a22dfa036e8da27143
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611840
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>
This change causes all CodeActions returned by gopls to use a
specific leaf type such as refactor.inline.call, instead of a
general category such as refactor or refactor.inline. The
categories may continue to be specified in the "Only" parameter
of a CodeActions request, and they apply hierarchically.
This allows clients to be more specific in requesting a
particular Code Action.
Details of golang/codeaction.go (messy diff):
- don't separate "typed" from "syntax only" operations;
in practice we always need types.
- enabled (func) replaces want (map). It is computed
in server.CodeAction and plumbed down.
- the "add" helper wraps a Command in a CodeAction
and adds it to the result.
Also:
- use camelCase names, following LSP's source.organizeImports.
- document the specific kinds in the user manual
and add a release note.
- remove the CodeAction title regexp parameter from
@codeaction{,err} marker tests since the kind is
now sufficiently expressive.
Fixesgolang/go#40438
Updates golang/go#68791
Updates golang/go#68783
Change-Id: I1898f79d8af441a0376ad5067d05e0621840d987
Reviewed-on: https://go-review.googlesource.com/c/tools/+/604818
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>
Currently, SignatureHelp reports information only about an
enclosing call expression. But it would be useful to show
signature information after entering the name of a function
such as "f" or "fmt.Println", without call parens.
So, if there is no enclosing call, this change reports the
signature of the selected identifier if it is callable.
Fixesgolang/go#68922
Change-Id: Ibb0700e354c5d6e5937fc7f7b5db65e9d96574bb
GitHub-Last-Rev: 5e7965edd3
GitHub-Pull-Request: golang/tools#510
Reviewed-on: https://go-review.googlesource.com/c/tools/+/605983
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Release notes: https://github.com/mvdan/gofumpt/releases/tag/v0.7.0
Note gofumpt now uses go/version to parse version string, so
fixLangVersion is no longer needed, but "go" prefix is a must.
Change-Id: I8b8e0eb3f0268cddf31ef2fcee90566a17a065ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/609655
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: 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>
TestCycles requires internal/trace/testtrace which was added in 1.23.
Fixesgolang/go#69387Fixesgolang/go#69408
Change-Id: Iaa6b24a94216e7f2d9f7239b131e4a7e9ef9210e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612399
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tim King <taking@google.com>
Also enables TestTypeparamTest/issue58513.go, which was
disabled for ssa/interp.
Fixesgolang/go#64726
Change-Id: I7966fd09e6ec8de662a99f21086f6a5c34d86ab9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612398
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Put the testing.T/B second when extracting functions/methods.
It's next after context.Context.
Fixesgolang/go#69341
Change-Id: Idcfc0e09e4174646a3f136dcc5badfda4af9938e
GitHub-Last-Rev: 99de9722e6
GitHub-Pull-Request: golang/tools#517
Reviewed-on: https://go-review.googlesource.com/c/tools/+/610976
Auto-Submit: 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>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Pop Function.targets when building a call to a range-over-func yield function and when building the yield function.
Also adds sanity checks to ensure all function transient fields are cleared.
Fixesgolang/go#69298
Change-Id: I38b80ce8939cf2cd6cfd0ce0c119d75356d80ebf
GitHub-Last-Rev: 8c45b9c36e
GitHub-Pull-Request: golang/tools#516
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611055
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This CL adds support for jumping to the definition of a doc link when
the import is renamed. Before, the doc link had to use the local
(renamed) name, which is unnatural; now, it can use either the local
name or the package's declared name.
+ test
Updates golang/go#61677
Change-Id: Ibbe18ab1527800c41900d42781677ad892b55cd4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612045
Auto-Submit: 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>
Commit-Queue: Alan Donovan <adonovan@google.com>
It wasn't broken on the builder--only with my local go toolchain.
(There was some cgo-related problem with cmd/cgo/internal/test.)
At least that explains why we didn't notice the failures...
This CL also adds a missing error check that made the real cause
of the problem hard to spot, and improves some comments and
assertions.
Fixesgolang/go#69287
Change-Id: Iccbe2a72770499749ca780f78e2a61d5576f613b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612044
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Fix the gopls build, which was broken by a semantic merge conflict with
CL 548675 (the slices package was made obsolete after updating to Go
1.23.1).
Change-Id: Ic8b82598b66c560298dd9b8f968a1087e12320f3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611839
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Implements test discovery. Tests are discovered as part of the type
checking process, at the same time as method sets and xrefs, and cached.
Does not implement the Modules command.
Adds static detection of simple subtests. This provides a framework for
static analysis of subtests but intentionally does not support more than
the most trivial case in order to minimize the complexity of this CL.
Fixesgolang/go#59445. Updates golang/go#59445, golang/vscode-go#1602,
golang/vscode-go#2445.
Change-Id: Ief497977da09a1e07831e6c5f3b7d28d6874fd9f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/548675
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
go/types sometimes fails to annotate type information onto
nested composite literals when there is a type error (#69092).
This CL adds a workaround to one particularly vulnerable place
in gopls that crashes when this happens. (There are potentially
many others.)
+ test
Fixesgolang/go#68918
Change-Id: I73e8e1dd8eb8965bde44d8ee3672a50ac362af52
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612042
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change moves ssa.forEachReachable into
internal/typesinternal.ForEachElement, simplifies
the signature (by internalizing the type map part)
and adds a test.
There are two copies of this algorithm (the other in
go/callgraph/rta), and we will need it again in
ssautil.Reachable (see golang/go#69291).
A follow-up change will make the copy in rta delegate
to this one (small steps).
Also, make ssa.Program.RuntimeTypes do the type analysis
when it is called, instead of doing it eagerly each time
we encounter a MakeInterface instruction.
This should reduce eventually costs since RuntimeTypes
shouldn't be needed: it was added for the pointer analysis
(since deleted) and it used by ssautil.AllFunctions (to
be replaced, see golang/go#69291), and in both cases it
is the wrong tool for the job because:
(a) it is more precise to accumulate runtime types in
the subset of the program of interest, while doing
some kind of reachability fixed-point computation;
and
(b) its use in AllFunctions is unsound because although
it accounts for all (too many!) MakeInterface operations
it does not account for types exposed through public
API (see the proposed replacement, ssautil.Reachable)
when analyzing incomplete programs.
Updates golang/go#69291
Change-Id: Ib369278e50295b9287fe95c06169b81425193e90
Reviewed-on: https://go-review.googlesource.com/c/tools/+/610939
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Since gopls now only builds with the latest version of Go, we no longer
need special linking to align with the compatibility windows of gufumpt
or staticcheck.
Updates golang/go#65917
Change-Id: I7d5ebe6807b34ed8d44e726c7a6585d4c7c7e696
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612055
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>
The go1.22 go/ast package now provides it.
Updates golang/go#60061
Change-Id: I24e201660e3a8752dd505eefc894c7acae4c99f3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612038
Auto-Submit: 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>
Address a long-standing TODO to permit multi-line locations in the
codeactionedit marker. This should unblock use of codeactionedit with
CL 610976.
Also use a 'converter' wrapper to add a bit more type safety in argument
conversion functions.
Change-Id: I851785c567bcde1a8df82a7921c2fba42def9085
Reviewed-on: https://go-review.googlesource.com/c/tools/+/612035
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>
The util/slices package has been deleted; but util/maps
has been renamed to moremaps since it still has some
useful things.
Note: the standard maps.Clone may return nil.
Updates golang/go#65917
Change-Id: Ide8cbb9aa13d80a35cdab258912a6e18a7db97c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611837
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>
Now that gopls is only built with Go 1.23, we can rely on
types.TypeString to preserve alias information, and only need the
bespoke logic of FormatVarType to handle the cases where types contain
an invalid type.
This should improve performance for completion, particularly since it
affects the single-threaded construction of candidates.
For example, here is the impact on a relevant benchmark:
Completion/kubernetes_selector/edit=false/unimported=false/budget=100ms
Results:
│ before.txt │ after.txt │
│ sec/op │ sec/op vs base │
81.29m ± 1% 65.83m ± 1% -19.02% (p=0.000 n=10)
│ before.txt │ after.txt │
│ cpu_seconds/op │ cpu_seconds/op vs base │
151.8m ± 15% 101.1m ± 33% -33.36% (p=0.000 n=10)
Change-Id: I60d890ca102a97cf6b198621ba82afe7eeab7fb9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611836
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>
(Yesterday's CL 609576 added a dependency on packages.Load.)
Fixesgolang/go#69299
Change-Id: Id858bbbb347ef137e053669b2fdef9522d057776
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611576
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
As noted in a TODO, it appeared that settings.Clone was failing to deep
clone several map or slice fields. A test revealed that ten (!) fields
were not deeply cloned.
Fix this by:
1. Removing pointers and interfaces from settings.Options, by making
ClientInfo a non-pointer, and by making LinksInHover a proper enum.
2. Adding a deepclone package that implements deep cloning using
reflection. By avoiding supporting pointers and interfaces, this
package doesn't need to worry about recursive data structures.
Change-Id: Ic89916f7cad51d8e60ed0a8a095758acd1c09a2d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/606816
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>
Remove the unused 'upperFirst' function, and fix a potential NPE due to
an incorrect predicate.
Change-Id: I671a3418b82ea77e5c9bb598f2be0b958078e464
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611575
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>
The tests check the callees at the call to yield and type flow out of
the range-over-func iterator. If needed, a test for defer will be added
in a follow-up CL.
Change-Id: Ic9208ac0824a36fb50879730e8ec9398b9b6e284
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>