go/gopls/internal
Robert Findley ccb10502d1 internal/lsp/cache: invalidate metadata when parsing issues resolve
Package loading (at least via go list) fails when the import header
doesn't parse, so we need to invalidate metadata upon a state change
from non parsing->parsing. Refactor metadata invalidation to implement
this feature, add additional documentation, and avoid unnecessary work.

This change revealed a latent bug (via TestDeleteDirectory): when
statting a deleted directory failed, we could fail to invalidate any
package IDs, even those we already knew about. This bug was masked by
the somewhat complicated semantics of pkgNameChanged. The semantics of
pkgNameChanged are simplified to encapsulate any change to a
package->file association.

Also refactor the parsing API somewhat, and add a bug report if we don't
get a ParseGoFile while inspecting for metadata changes.

Update most regtests to panic upon receiving bug reports.

Fixes golang/go#52981

Change-Id: I1838963ecc9c01e316f887aa9d8f1260662281ab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/407501
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
2022-05-23 18:14:40 +00:00
..
coverage gopls/internal/coverage: apply gofmt to the build tag syntax 2021-04-08 20:55:59 +00:00
govulncheck internal/govulncheck: copy from x/vuln repo 2022-05-18 18:10:12 +00:00
hooks gopls: upgrade staticcheck to v0.3.0 2022-04-07 14:59:24 +00:00
regtest internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
vulncheck internal/govulncheck: copy from x/vuln repo 2022-05-18 18:10:12 +00:00