This CL adds a <select> element with an index of all
sections in the page, following the design of pkg.go.dev.
Change-Id: I41b6719e85d0ace7edb864c5b20ae1f5b8e39d1b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576596
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>
Now that the compiler support for gotypesalias=1 is
fixed (by CL 574737), we can reenable these tests.
Updates golang/go#66550
Updates golang/go#65294
Change-Id: I70b187c561d2eeb3f7a4cc078107b7bcce5ced01
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576139
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>
This change causes Hover to reveal the percentage of a struct
type's size that is wasted due to suboptimal field ordering,
if >=20%.
+ test, release note
Fixesgolang/go#66582
Change-Id: I618f68d8a277eb21c27a320c7a62cca09d8eef0a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
The random base64 strings in gopls URLs caused occasional
spurious matches for the substring t1. This change uses
a non-base64 letter to eliminate this source of
nondeterminism.
Change-Id: I1db1dca8d93cc299b13b591567fa72b2227ac436
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576140
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>
It changes (improves) the behavior of the test; we will reenable
it once the default has changed.
Updates golang/go#65294
Change-Id: I716da405a9f0c03c303c4c0be8b738dd7c5ebdcd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576137
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>
Fix the same crash as golang/go#66195, this time in Analyze: don't set
invalid Go versions on the types.Config.
The largest part of this change was writing a realistic test, since the
lack of a test for golang/go#66195 caused us to miss this additional
location. It was possible to create a test that worked, by using a flag
to select a go1.21 binary location.
For this test, it was required to move a couple additional integration
test preconditions into integration.Main (otherwise, the test would be
skipped due to the modified environment).
Fixesgolang/go#66636
Change-Id: I24385474d4a6ebf6b7e9ae8f20948564bad3f55e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/576135
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>
Filter diagnostics only to the "best" view for a file. This reduces the
likelihood that we show spurious import diagnostics due to module graph
pruning, as reported by golang/go#66425.
Absent a reproducer this is hard to test, yet the change makes intuitive
sense (arguably): it is confusing if diagnostics are inconsistent with
other operations like jump-to-definition that find the "best" view.
Fixesgolang/go#66425
Change-Id: Iadb1a01518a30cc3dad2d412b1ded612ab35d6cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574718
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Working with go.sum files in integration tests was cumbersome, involving
temporarily modifying the test to call env.DumpGoSum(...), then copying
its output into the static go.sum file.
For some tests, we may actually want to check in a fixed go.sum file,
but the majority of the tests just want to avoid go.sum errors. To
support this use case, add a new RunOption that writes the go.sum file
before starting the test. Use this option in a test to illustrate its
usage.
Also, update DumpGoSum to use the faster "./..." pattern to create the
go.sum output. "..." matches all modules, but we only care about the
main module.
Change-Id: I32cca005e10411033422cf8fee64cbd56e83f64c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Previously, a variety of links generated by the go/doc/comment
package were not valid. This CL configures the parser and printer
hooks to query the cache.Package representation, and now
generates valid crosslinks for all references.
Tested interactively on a wide variety of cross links.
Change-Id: Iaf1fffe52ea96e3be5df78227cf8395006caa59a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575377
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>
My previous audit of this file contained a mistake in the order
in which constructors were tested; it was revealed by testing
with gotypesalias=1.
Updates golang/go#65294
Change-Id: I80f6f0bb24bceb2c69b9919e9c482b780c0d546a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575699
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 adds support for preserving materialized aliases
while types transit export data (indexed or unified).
(This CL depends on CL 574737 to the compiler and
go/types.)
Updates golang/go#65294
Updates golang/go#64581
Change-Id: I1a0a08357e4f6a480ba6250fbea327922e455873
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574717
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
staticcheck will need work to accommodate gotypesalias=1.
In the meantime we disable this test in that mode; we plan
to reenable it before the next gopls release.
Updates golang/go#65294
Change-Id: I857edb758f83f180a4d92b7100e99c3401b1d957
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575698
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL causes the package rendering to emit an <a id=...> anchor
for each name defined by a var or const declaration.
Also, choose the initial fragment id (e.g. "#Buffer.Len") based
on the selection.
+ Test that anchors are emitted.
Change-Id: Idb4838a6d2741a26cd9dbb5ad31a76d6f811ff26
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575697
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>
When "View package documentation" is invoked in a _test.go file,
this change ensures that the documentation for the package under
test is displayed, instead of a 404 Not Found.
Change-Id: I9c9f2205d6ec72cbe5acea1480acdbf2bd3b8b53
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575695
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 CL causes the "View package doc" pages to display a
banner when the gopls server dies, at which point the page
is no longer operative. (A new server will have a different
port.)
Change-Id: Icde10a7b4c25a28177d043c573dfdab4ce7c7964
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575536
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ensure that when types.Checker.Files returns an error some
error is always reported and the package is illTyped.
Adds an additional hint to recompile the tool when types returns
an error "package requires newer Go version 1.22" or similar.
Updates golang/go#65608
Updates golang/go#66525
Change-Id: I131ee3e668815f88d16a18c6e92f002220284a03
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574255
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This analyzer shows a very high rate of true positives,
indicating that code is (at best) unnecessarily complex
and confusing but, often, not working as intended.
+ release note
Fixesgolang/go#44461
Change-Id: I1c86e7305a8d512d7e4d1bbec3b2b44ce3a9c9ab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575061
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change causes Hover to report size information for
types and struct fields when hovering over
the declaring identifier, plus offset information for
struct fields.
Some tests needed tweaks to make them CPU-independent,
or to disable them on 32-bit machines.
Also, add the first release notes using the new
git+gerrit workflow (and backfill a missing item for
"View package documentation").
Change-Id: Ibe8ac5937912c3802f3ad79e3d9f92ba24eb51de
Reviewed-on: https://go-review.googlesource.com/c/tools/+/573076
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>
The associated bug was a crash in package doc rendering due to
invalid ASTs resulting from mutation caused by doc.New, even
in PreserveAST mode. (This bug has been latent since 2018.)
The mutation occurs when filtering out unexported symbols.
This change is a workaround: we enable AllDecls mode to
suppress filtering, and perform the filtering ourselves.
Also, add a regression test for the panic, and check
the new filtering behavior. This required some test
refactoring.
Fixesgolang/go#66449
Updates golang/go#66453
Change-Id: I434c97e08930728d4894b90c1c7e010e7a922209
Reviewed-on: https://go-review.googlesource.com/c/tools/+/573575
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>
DeleteSyntheticNodes currently removes instantiations of generics from
the call graph. This function is intended to remove synthetic functions
that don't have a counterpart in the source code. Instantiations of
generics do not fit that bill. This also caused problems in govulncheck
where a function call to instantiation was missing from a call stack.
The fix is to keep instantiations and improved the documentation of
DeleteSyntheticNodes.
Change-Id: I32392b7495a8c1a5f6b26f795d46c8f184983e67
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575095
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
Auto-Submit: Zvonimir Pavlinovic <zpavlinovic@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Fixes Google Issue 331478795
Change-Id: I0258bdd6a50000effc66c4e1fe03f99e2720c0cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/575056
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>
Adds a RunOption NoLogsOnFailure() to suppress the printing of
the voluminous LSP logs when there is a test failure. While debugging
tests these logs can be a noisy distraction.
Change-Id: I41379fdcef8ba00f8b8a49ec89d8795274797888
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Before this change gob encoding of these facts was failing with:
`gob: type analyzer.inlineMeFact has no exported fields`
gob encoding is required for all facts as analyzer drivers use it to
share facts between the analysis of different packages as stated in
the docs:
A Fact type must be a pointer. Facts are encoded and decoded using
encoding/gob. A Fact may implement the GobEncoder/GobDecoder
interfaces to customize its encoding. Fact encoding should not fail.
Change-Id: Ifb0eb57b0f582ec228a21a0d17e3bbd33c560d3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574435
Auto-Submit: Lasse Folger <lassefolger@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Change-Id: Ib42e91d90ecd6e3bda69dbfa6ae2489fd2a0185c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572476
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
This CL does for the gopls module what CL 565035 did
for the x/tools module.
In particular, we don't yet address desired behavior
changes for materialized aliases, nor generic aliases.
Change-Id: Iace78c1f8466afe8a6a24e3da3d6f431bf5ebc3e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/565756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
This CL adds an unexported command for inspecting "unified" export
data produced by the compiler, and checking that it can be
roundtripped through "indexed" format as used by gopls.
Change-Id: Idc8eea5c8d7287d7f10af7bd15c7a52e6987a4bf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572795
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 change gets the renaming of aliases right when
they are materialized by GODEBUG=gotypesaliases=1.
(Obviously there's no way to get it right without
that feature.) And it adds a (conditional) test.
Updates golang/go#65294
Change-Id: Ie242e3a0a9d012218067bdc61a901f6618fecbb5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567842
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 change defines Deref(T), which returns the type of
the variable pointed to by T if its core type is a pointer,
or T otherwise, and removes all the various other flavors
of 'deref' helper that exist across the repo.
Also fix and test a generics bug in fillstruct.
Updates golang/go#65294
Change-Id: I14f6f35b58eefbad316391745745d662b061c013
Reviewed-on: https://go-review.googlesource.com/c/tools/+/565456
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>
CL 559635 changed newModuleResolver so that it can return
(nil, err). That means it is no longer safe to unconditionally
convert the first result to a Resolver interface, but we
forgot to check in two places, causing a crash that was
reported by telemetry.
This change adds the two checks.
Fixesgolang/go#66490
Change-Id: I3f2b84ed792b1eea179fc0d4d5ee9843281506fc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/574136
Reviewed-by: Peter Weinberger <pjw@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Removes a few instances of unneeded Unalias calls, and
adds additional documentation about aliases.
Change-Id: I02045ef74d6d9b80189caf6a9831bded2bae5ad4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/568176
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
The typeparams.Free.Has(T) method reports whether type T
has free type parameters. It factors two copies of this
algorithm, themselves copied from go/types.
Change-Id: I285e26ba82b28ca0a3ddbd956fa75e342a0dc22d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/573135
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>
Commit-Queue: Alan Donovan <adonovan@google.com>
Change-Id: Id4d3bcdcb663dccaf149ccadae1d0513c868a049
GitHub-Last-Rev: 4534649b01
GitHub-Pull-Request: golang/tools#486
Reviewed-on: https://go-review.googlesource.com/c/tools/+/573015
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>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Fixes a bug where ReceiverNamed returns a nil *types.Named if the type is
not a Named type.
Updates related documentation in httpmux.
Fixesgolang/go#66259
Change-Id: I512feeb11473f2278edf4d9ef3312319d9dd1edf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571057
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
x/vuln/cmd/govulncheck -json output format has changed to include
module level vulnerabilities. We knew this change would eventually
come and had handling in gopls/internal/mod/diagnostics.go
'foundVuln'. But we didn't update TestRunVulncheckWarning &
TestRunVulncheckInfo to get prepared. This is a test-only bug.
Fixesgolang/go#65942
Change-Id: Ib7545279d07caf708c4f5392b51df273256432e6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/567155
Reviewed-by: Suzy Mueller <suzmue@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL limits the number of goroutines created by Program.Build
to the number of P's, since building is entirely CPU bound.
Creating more than this number of goroutines just increases
churn, and potentially increases cache and allocator contention,
and increases peak memory usage and GC.
The effect on TestStdlib's "build SSA" timing metric seems
to be a reduction of around 2-3%, but it's fairly noisy.
Change-Id: Ie85e93b99c27ece245be05892818d52ae3b7fbc1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572796
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>
Rearrange the counters so that there is one set describing the
set of suggested completions (empty, short, long) and one set
describing what the user does (used, not used, can't tell).
A set of suggested completions is long if there are more than ten
of them, which is about how many clients show to users.
If a client sends back changes to file, gopls can decide if a
completion was used or not, but it does not try to tell if the client
sends back a new whole file.
These sets of counters correspond to two partitions.
Change-Id: I861a5743b16e488074fd2e58cb63c6a8aea52735
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572315
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
CL 567837 deleted mkstdlib.go (a generator) and zstdlib.go (its output).
For golang/go#46136.
For golang/go#38706.
Change-Id: If5623e3ab014c2fee63b1d058c726ea5acb06aa2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571276
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
slices has been supported in go1.21 and go1.22
Fixesgolang/go#66222
Change-Id: I7b319e649632a713200dcaabd1e68d1f01e1b2f2
GitHub-Last-Rev: fc1d59d86a
GitHub-Pull-Request: golang/tools#484
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572116
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Update the canRemoveParameter logic to reflect that we don't try to
remove parameters when there are parse or type errors.
Change-Id: Ia8239a383b56763d100c69c9a3633c87025b81cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572297
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Make a minimal change to the removeparam algorithm to support removing
unused parameters of methods.
This doesn't address the problem of expanding the set of signatures or
calls based on interface satisfaction constraints: that is really a
separate concern, which also affects method renaming (golang/go#58461).
Were we to have a more general solution to that problem, it would be
relatively straightforward to also expand the change signature
algorithm.
For golang/go#38028
Change-Id: I296cb1f828f07d841c83b1fd33593ccd2fee3539
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572296
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Unbreak the x/tools build dashboard due to a semantic conflict between
CL 572475 and CL 571215.
Change-Id: I8ce1308ee99e75aa7cf8f7bd1d8b1dedcb845f4d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572515
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL moves the stdversion analyzer out of gopls,
into the exported analyzer tree, whence it will be
vendored into cmd/vet in a follow-up.
Updates golang/go#46136
Change-Id: I039ef78ecdcfd6bc64d5b089017a9b8635cf9aa5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572035
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>
This CL adds a "View package documentation" code action to any
selection in a Go source file. Its command has two effects:
1) to start a web server associated with the current LSP
server, with coupled lifetimes, and register a handler
to serve the package documentation; and
2) to direct the client to open a browser page
showing the package documentation for the selection.
The server is a minimal imitation of pkg.go.dev,
working off the cache.Package representation. This means
we can display doc markup even for unsaved editor buffers,
and show type-derived information such as method sets
of each type.
Clicking through to the source--which on pkg.go.dev goes
to cs.opensource.google--causes the client editor to
navigate directly to the source file, using the magic
of showDocument requests.
The web server is secure in that all its endpoint URLs contain
an unguessable secret, so a local process belonging to
a different user can't access source code by port scanning.
The CL includes a test that
(a) the webserver content reflects edits (even unsaved)
in the source buffers, and
(b) that "clicking" through the source link causes
the server to navigate the client editor to the
correct source location.
A couple of tests that asserted "no code actions" needed
to be tweaked, as now there is always at least one
code action in any Go source file.
Change-Id: I2fe1f97e4e2b0b15cff6a4feb66501fce349b97d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/571215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
The runtime.GOROOT function is about to be marked as deprecated, which
will generate a diagnostic that isn't expected in format.txt test case.
Pick another hopefully somewhat future-proof identifier, since dealing
with this doesn't seem to be in scope of this test case.
For golang/go#51473.
Change-Id: I54d7ed0b43860bcd41938328211797a0cdd60e36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/564275
Auto-Submit: 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>
Reviewed-by: Robert Findley <rfindley@google.com>
Rename methods on cache.Package to eliminate unnecessary "Get" prefixes.
Also rename pkg.go to package.go.
Change-Id: I42f2fa7a18a5973a53af93c63b48c7db19cba3b2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
The new method formats the graph in the syntax used by
the 'dot' command from https://graphviz.org/.
Fixesgolang/go#65754
Change-Id: Icf696419070e19b2f2236ac1e4aaa09323c565de
Reviewed-on: https://go-review.googlesource.com/c/tools/+/572016
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>