As reported in golang/go#67684, the unusedwrite analyzer may have false
positives when used with unsafe, so silence it if unsafe is imported.
This is a rather large hammer, but there is a high likelihood of such
false positives, and they significantly detracting from the usefulness
of the analysis. Specifically: this noise causes Go developers to
disable the analyzer.
Fixesgolang/go#67684
Change-Id: I855a5da6124a0495c7eb11722b466824689780a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621817
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>
For the purposes of go/analysis, gopls could not skip syntactic object
resolution, as it is part of the go/analysis contract. This prevents
analysis from reusing existing type-checked packages, leading to
increased CPU and memory during diagnostics.
Fix this by making object resolution lazy, and ensuring that all
analysed files are resolved prior to analysis.
This could introduce a race if gopls were to read the fields set by
object resolution, for example if it was printing the tree using
ast.Fprint, so we include a test that these fields are only accessed
from packages or declarations that are verified to be safe.
Since the resolver is not separate from the parser, we fork the code and
use go generate to keep it in sync.
For golang/go#53275
Change-Id: I24ce94b5d8532c5e679789d2ec1f75376e9e9208
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619516
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
...as it lacks various OS fundamentals like pipes,
which are now used in the test (see CL 622355).
Fixesgolang/go#70052Fixesgolang/go#70051
Change-Id: I7f247a77a284f0e61f207bd84a5f3c1c2f412b68
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622323
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
(*Index).Lookup returns matching symbols from the index.
Change-Id: I7b805be9a08116e111bb8d6453ed67f8cc92dd4d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Although the workaround in CL 621855 was effective for gopls,
which uses go1.23, the x/tools builders using go1.22 are
still bumping into this data race.
This change applies the same workaround to go1.22;
the data type has not changed.
Fixesgolang/go#69912Fixedgolang/go#70015
Change-Id: I9f12f8815a0b089a188b9d02aec9d07eb30a496a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622319
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Create() creates a new index, while Update() may write an
updated index, if there have been any changes in the module cache
since the last index was written. If there is no index it creates
one. It returns true if it wrote a new index, false if there was
no need to write a new index.
Change-Id: Ic797796c2ab6db6bd93b2059df86249ae62ca8ec
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621860
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The "unhashable" panic message had changed in go1.14.
Fixesgolang/go#34089
Change-Id: I6ba97d33fefee9e217b65904db2b07c2091d80be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
The interpreter tests have long been exceedingly noisy because
they write to os.Stdout and os.Stderr directly. This CL
temporarily redirects the output to a buffer (via a pipe),
which is printed via t.Log once the interpreter returns.
This means that a test failure only prints the output relevant
to that test.
Change-Id: Id1835a9b0f91a09fdc7e61dab38906a7b42e300f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622355
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
analysisNode.cacheKey shows up as very hot in benchmarks, yet analysis
should observe the same invalidation heuristics as other package data.
Memoizing the cache keys in the snapshot reduced total CPU of
BenchmarkDiagnosePackageFiles by 10-15%.
For golang/go#53275
Change-Id: I0f60c3e78c77ac6e58b14308bb0331022babae69
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622037
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>
Make pull diagnostics async, to optimize handling of many simultaneous
requests for the diagnostics of open files. Accordingly, update the pull
diagnostic benchmark to request diagnostics concurrently.
Naively, these concurrent diagnostics would cause gopls to incur major
performance penalty due to duplicate analyses -- as much as 5x total CPU
in the pull diagnostic benchmark. To mitigate this cost, join ongoing
analysis operations using a shared global transient futureCache. This
reduces the benchmark back down close to its previous total CPU, with
reduced latency. Eyeballing the net delta of this CL in the benchmark,
it looks like +20% total CPU, -30% latency.
As a nice side effect, this more than eliminates the need to pre-seed
the file cache in the gopls marker tests. The shared futures provide
more consolidation of work than the pre-seeding, because of variance in
the cache keys of standard library packages, due to different gopls
options.
For golang/go#53275
Change-Id: Ie92bab4c140e3f86852531be8204b6574b254d8e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622036
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>
It confuses me whenever I look for doc/release/*.md and
appears not to have been touched in a long time.
Change-Id: I101577e75e884ace46e0fc49d550ada1036237e9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622175
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
As demonstrated in golang/go#68046, it was possible to have infinite
recursion in objectpath.For searching for objects within recursive
interface definitions. Fix this by breaking cycles.
Refactor somewhat to simplify the recursive search.
Fixesgolang/go#68046
Change-Id: Idb65e305ec5949d212ec8dafff824486178652df
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621818
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>
Work around golang/go#69912 by punching a hole through the TypeName type
to mark it black after importing. This is an unfortunate workaround, but
the fix for the long-standing data race is probably not worth
back-porting.
For golang/go#69912
Change-Id: I583305f6e893e28b881dab932c9c4825430bc4ad
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621855
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
When go/packages.Load returns an error, or has packages with errors, we
should not assume that assumptions of the resulting packages still hold.
I believe this is the cause of the two telemetry bug reports below.
Fixesgolang/go#66204Fixesgolang/go#69895
Change-Id: I9beab020ddb37d36a8826cb36a576990463d7bce
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621859
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>
This setting was slated for removal in gopls@v0.16. Nobody has
complained on the linked bug. Remove it.
Fixesgolang/go#66861
Change-Id: I942dbd06755114a13ef097b4a57ffe169441e76f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621877
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>
Refine a bug report to isolate incoherent package metadata potentially
related to using a GOPACKAGESDRIVER.
For golang/go#64235
Change-Id: I82dc6f53b1668d15cbfc146e5cf9b3c5d2ad79c5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621858
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>
Refine a few bug reports related to incorrectly positioned type checker
errors, by differentiating the 'fixed file' case from the case with no
fixed files.
Since we haven't made progress on these bugs, we need more information
to guide our debugging.
If the bugs only occur in the presence of AST fixes, we can probably
downgrade them to not be a bug: if we're fixing the AST, we won't
display type checker errors anyway. Nevertheless, leave the bug reports
for now, so that we can collect data.
For golang/go#65960
For golang/go#66765
For golang/go#66766
Change-Id: I2060c897d249cdd5cc3e7bb183d3f563987bec57
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621876
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>
Otherwise it can be very hard to guess why two issues' rules
intersect!
Change-Id: I4ac88b9e95f79cf4b2b1f4c8072a6c90c07bb295
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621815
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>
At the protocol level, this operation requests all CodeActions
of kind "quickfix", so that's the appropriate name.
(SuggestedFix refers to types in go/analysis and in
gopls/internal/cache that are only loosely related.)
All the tests of @quickfix are now beneath testdata/quickfix
(except diagnostics/typeerr.txt since that's not its primary aim).
Change-Id: I907aab2fcc4c7f99170c1eefa5ee2cb8aca6331f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621598
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>
Gopls tests are failing on CL 620196, where a test file is being added
to the builtin package. The failures were caused by test workspace
picking up new std dependencies through the builtin test variants, which
were being handled like normal packages. Queries like completion or
workspace symbols were affected, as they scan transitive imports.
Ignore builtin test variants to fix the breakage.
Change-Id: Ia1a99918b0bfb470c74470fa82e03e49fa460b06
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621095
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
As described in golang/go#69937, we need a mechanism that allows for
concurrent request handling in gopls. However, this cannot be
implemented entirely within the jsonrpc2 layer, because we need gopls to
observe requests in the order they arrive, so it can handle them with
the correct logical state.
This CL adds such a concurrency mechanism using a trick similar to
t.Parallel. Specifically, a new jsonrpc2.Async method is introduced
which, when invoked on the request context, signals the
jsonrpc2.AsyncHandler to start handling the next request.
Initially, we use this new mechanism within gopls to allow certain
long-running commands to execute asynchronously, once they have acquired
a cache.Snapshot representing the current logical state. This solves a
long-standing awkwardness in the govulncheck integration, which required
an additional gopls.fetch_vulncheck_result command to fetch an
asynchronous result.
This enables some code deletion and simplification, though we could
simplify further. Notably, change the code_action subcommand to
eliminate the progress handler registration, since we don't need
progress to know when a command is complete. Instead, use -v as a signal
to log progress reports to stderr.
Fixesgolang/go#69937
Change-Id: I8736a445084cfa093f37c479d419294d5a1acbce
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621055
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL eliminates the "goroot" flavor of
TestIExportDataTypeParameterizedAliases, leaving just
the "tools" flavor, and simplifies accordingly.
The logic of the goroot version assumed that importer.Default()
could read what gcexportdata.Write would write... except that
that comments correctly stated the assumption was false.
Updates golang/go#68898
Change-Id: Ifded4ed2cc2103de32ac869731176a49877d10e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/620036
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>
This PR corrects a typo in the error message for the reverse.Search function.
The word "irrefexive" was incorrectly spelled and has been corrected to
"irreflexive."
Change-Id: Iaf838962c994919d4a0c39b78907c3a716d16dd9
GitHub-Last-Rev: 8ee307e3ed
GitHub-Pull-Request: golang/tools#531
Reviewed-on: https://go-review.googlesource.com/c/tools/+/620057
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>
Symbol types should be a single character, and now they are.
func F(int, float) is legal. Before it was being treated as if it were
F(), now it is treated as if it were F(_ int, _ float), which seems
better.
Change-Id: I051f60b16edccf54c4ce30f11b33a458413fa9af
Reviewed-on: https://go-review.googlesource.com/c/tools/+/620138
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Presently the command will create or update the index of the module
cache, or clean out obsolete indexes. An index is obsolete if it is
both more that an hour old, and not a current index pointed to by some
index-name file.
Change-Id: Ie3a79587e0e230ae7ab0b7d854c97003ace783ff
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616838
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This CL is the result of a quick audit
of x/tools for places that look in the Types map and do
not handle missing entries gracefully (unless dominated
by a check for welltypedness, such as RunDespiteErrors:false
in the analysis framework). In each case it either adds
a defensive check or documents the assumption.
See https://github.com/golang/go/issues/69092#issuecomment-2389643780
Updates golang/go#69092
Change-Id: I3573512fd47ee4dca2e0b4bce2803b92424d7037
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617416
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>
This CL contains tests that the module cache
index can be updated. The tests cover all the
cases in modindex.go.
Change-Id: Ia5988fb0d2be1cbe5e26d9d5d0f0d43ce1e0e5d2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619695
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL causes stacks to check for the presence of a go.mod file
for each cloned repo, not just a directory, as the tmpreaper (at
least on macOS) deletes the stales files before it deletes the
directories. If the file is not found, we delete the directory
tree.
Change-Id: Idf4990f707704e12ae15120269cf7d490e406b41
Reviewed-on: https://go-review.googlesource.com/c/tools/+/620035
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 CL deletes unreferenced declarations and unexports
some unnecessarily public ones.
Change-Id: Ic257645c39bedfe151b92134b148ddb99bf3bf4a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619855
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 provides a new "quickfix" code action to repair a
function call x.f() with a "type X has no field or method f" error
by generating a stub declaration of the missing method.
- extract common functionality about adjusting import,
generating diffs to a shared function.
- add new stubMissingCalledFunctionFixer (for missing method calls),
change stubMethodsFixer to stubMissingInterfaceMethodsFixer
(for interfaces) to make it not vague about which kind of stub
it actually be.
- algos to get type info: for arguments, get type directly,
for return values, currently only implement inferring from variable
assignment and parameter assignment.
- remove a test in stub.txt that tests local types can't be stubbed,
after this CL, this check has been moved to GetCallStubInfo
and GetIfaceStubInfo, thus gopls will not offer a bad fix.
There is a detailed test that demonstrated this pr.
Fixesgolang/go#69692
Change-Id: Ia7aecdaf895da2a9a33b706f26b7766e4d42c8a1
GitHub-Last-Rev: 7d9f4e0b46
GitHub-Pull-Request: golang/tools#528
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617619
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: 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>
Commit-Queue: Alan Donovan <adonovan@google.com>
Derived from https://go.dev/cl/603935.
Change-Id: I1c5ab7cc180c33e69244fe2cfdc79fd9625eab95
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619235
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>
Change-Id: I4f4c670f002272b3fa45e7f7eb43916413c975a4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618896
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tim King <taking@google.com>
Commit-Queue: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Load should return an error when 'go list' command returns the following error:
err: exit status 2: stderr: go: no such tool "compile"
This occurs when internally running `go list` on a misconfigured GOROOT directory.
Fixesgolang/go#69606
Change-Id: Ib7bf58293612e26aa33d2cf8230378747ad01820
Reviewed-on: https://go-review.googlesource.com/c/tools/+/615396
Reviewed-by: Michael Podtserkovskii <michaelpo@meta.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
This reverts commit f8f3c13ff3.
Reason for revert: https://go.dev/cl/619395 appears to be a better solution for the same problem.
Change-Id: Ie3f290fca74b2cc2627484504b6db780f89b3bb4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619415
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tim King <taking@google.com>
Set gotypesalias=1 when using >=1.23 toolchain on all of
the main packages in x/tools that use go/types. Does not include
packages that are ignored due to build tags.
This effectively upgrades commit https://go.dev/cl/617095.
For golang/go#69772
Change-Id: I434c280b928ad21e1fd9c7f880e1324c14741dc3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619395
Reviewed-by: Robert Findley <rfindley@google.com>
Commit-Queue: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
A NamedOrAlias represents either a *types.Named or a *types.Alias.
Used this generalization in gopls.
This change is derived from https://go.dev/cl/603935.
Change-Id: Ica1669784dec6bcdefafde02e9a6ce789db28814
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Tim King <taking@google.com>
In CL 613715, we made import lookup lazy to mitigate the quadratic
construction of the import map during type checking. This CL makes the
equivalent change for the analysis driver.
Since analysis does not have fine-grained invalidation, it is even more
susceptible to the performance cost of this quadratic operation:
DiagnosePackageFiles-64
│ before.txt │ after.txt │
│ sec/op │ sec/op vs base │
1691.6m ± ∞ ¹ 693.6m ± ∞ ¹ -59.00% (p=0.008 n=5)
│ before.txt │ after.txt │
│ cpu_seconds/op │ cpu_seconds/op vs base │
6.480 ± ∞ ¹ 3.260 ± ∞ ¹ -49.69% (p=0.008 n=5)
For golang/go#53275
Change-Id: I8690bc85848fe1e36391d4622aa2e3d3f9878f57
Reviewed-on: https://go-review.googlesource.com/c/tools/+/619095
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>
Fix a broken test build on android due to inconsistent build constraints
in test files.
Change-Id: I6350797fb65f2f2699e11b95b01a4aa3b3b84307
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618996
Run-TryBot: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Add a benchmark that exercises a currently slow operation using pull
diagnostics: requesting diagnostics for a large number of package files.
For golang/go#53275
Change-Id: I233cfaeb4242ab44a7b46c870a195fdf7793c05c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618995
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 vtaGraph type stores a directed graph, where the nodes are interface
values.
This change maps the nodes to unique integers internally and stores the
adjacency lists of the graph using the integers, which are smaller and
faster to work with.
This saves 40% time and peak memory usage when analyzing some very large
projects.
Change-Id: I45468ea9b478d2291f80140158cc8719e992b14e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614095
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Also:
- add reminders to keep things in sync.
- use explicit anchors instead of relying on GitHub's
unspecified algorithm (which doesn't work in mdweb preview).
Fixesgolang/go#54115Fixesgolang/go#68791
Change-Id: I17c800075260e2e72dcd239fb7248a0cb3851d5d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618616
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>
Fixesgolang/go#69783
Change-Id: Iebdd90527de4efe8995d5b42d6e25089761135dc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/618555
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 adds information about exported symbols to the module cache
index, together with a minimal test.
A future CL will add a Lookup function for finding completions for
selectors.
Change-Id: Ic36b5f30383187f9c5551ee2757258ed1445ea53
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616416
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Implement the scaffolding for pull diagnostics. For now, these are only
supported for Go files, only return parse/type errors for the narrowest
package in the default view, do not report related diagnostics, and do
not run analysis. All of these limitations can be fixed, but this
implementation should be sufficient for some end-to-end testing.
Since the implementation is incomplete, guard the server capability
behind a new internal "pullDiagnostics" setting.
Wire in pull diagnostics to the marker tests: if the server supports it
("pullDiagnostics": true), use pull diagnostics rather than awaiting to
collect the marker test diagnostics.
For golang/go#53275
Change-Id: If6d1c0838d69e43f187863adeca6a3bd5d9bb45d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/616835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Previously, gopls was keeping a common import graph up to date between
snapshots, to optimize re-typechecking open packages. However, this had
several downsides:
- It required rather complicated accounting
- Working in package A could get slower after opening package B, if
package B was in the forward closure of A, since it reduced the
common import graph.
- Since imports were constructed a-priori to type checking, we imported
*all* packages in the forward closure of open packages, even if they
wouldn't be needed for type checking, inflating the memory footprint.
This CL changes gopls to instead keep track of the active package on the
packageHandle, and invalidate its imports independently of other active
packages. As a result, we can eliminate the complicated importGraph
logic and the associated relationships between open packages. We also
reduce memory by holding on to a minimal set of imports for open
packages.
Change-Id: I82c49bb7002ab748497f34b43844b34176bdef9c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/614165
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>
InitFileVersions is not longer conditionally needed at x/tools
supports Go >= 1.22.
Change-Id: I5df1b46463d23acda569e1378027d542ac749f93
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Tim King <taking@google.com>
Change-Id: I1105cec5cf851932a15410a674196e32c97ac832
GitHub-Last-Rev: a324267649
GitHub-Pull-Request: golang/tools#527
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617617
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Updates test expecations now that go.dev/cl/607955 has been submitted.
Change-Id: I795a14f7690026620f270e2db329945286764046
Reviewed-on: https://go-review.googlesource.com/c/tools/+/617635
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Tim King <taking@google.com>
Syscall will write register implicity, which asmdecl should allow
this writes.
Fixesgolang/go#69352
Change-Id: I7e0dece5428e9ef359b89ce418adc533f7515b1b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611815
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>