go/gopls/internal
Alan Donovan 2592a854ec gopls/internal/lsp: simplify KnownPackages
This change simplifies the two functions called KnownPackages,
and renames one of them.

The first, source.KnownPackages, is a standalone function
called in exactly one place: ListKnownPackages.
It has been renamed KnownPackagePaths to distinguish
from the other and to make clear that it returns only
metadata. Its implementation could be greatly simplified
in a follow-up, as noted. In the meantime, one obviously
wrong use of ImportSpec.Path.Value (a quoted string literal!)
as an package (not import!) path was fixed, and the package
name was obtained directly, not via CompiledGoFiles.

The second, Snapshot.KnownPackagePaths, is called from two places.
This CL eliminates one of them: stubMethods used it apparently
only to populate a field of missingInterface (pkg) that was unused.
The other call (from 'implementations') is something that should
eventually go away as we incrementalize; in any case it doesn't
rely on the undocumented ordering invariant established by the
implementation. This change removes the ordering invariant,
documents the lack of order, and removes the ordering logic.

Change-Id: Ia515a62c2d78276b3344f2880c22746b2c06ff64
Reviewed-on: https://go-review.googlesource.com/c/tools/+/451675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-11-18 17:22:07 +00:00
..
coverage gopls/coverage: repair coverage.go 2022-11-07 18:26:12 +00:00
govulncheck gopls: sync golang.org/x/vuln@3af8368ee4fe 2022-11-10 23:14:17 +00:00
hooks gopls: update dependencies following the v0.10.0 release 2022-11-04 16:52:27 +00:00
lsp gopls/internal/lsp: simplify KnownPackages 2022-11-18 17:22:07 +00:00
regtest internal/lsp/cache: remove support for invalid metadata 2022-11-18 17:16:01 +00:00
robustio internal/robustio: fix log.Fatal calls that should be log.Fatalf 2022-10-10 21:31:25 +00:00
span gopls/internal/lsp: tolerate missing end position in RelatedInformation 2022-10-19 18:04:39 +00:00
vulncheck internal/testenv: skip tests that need export data for std if 'go tool compile' does not exist 2022-11-17 20:46:33 +00:00
migrate.sh gopls/internal/migrate.sh: a script to migrate internal/lsp to gopls/ 2022-09-07 14:10:36 +00:00