go/internal/lsp/fake
Robert Findley f1bb5ca08f internal/lsp/cache: report a critical error when go.work is invalid
When a go.work file fails to validate, the workspace is left in an
invalid state: we will detect that the workspace is defined by the
go.work, but will not actually parse any active modules. This should be
a critical error.

Fix this by adding allowing the workspace to surface critical errors via
a new cache.workspace.criticalError method.

Additionally:
 - only build the workspace mod file in workspace.build if the mode is
   fileSystemWorkspace (in all other modes the modfile is already
   determined)
 - rename workspace.invalidate to workspace.Clone, to be consistent with
   other data structures
 - rename CriticalError.DiagList to CriticalError.Diagnostics
 - add several TODOs for observations while reading the code
 - create a new file for regtests related to broken workspaces
 - make the regtest sandbox panic when duplicate paths are present in
   the sandbox file set (an error I made while writing the test)

Updates golang/go#53933

Change-Id: If8625ab190129bc9c57e784314bc9cc92644c955
Reviewed-on: https://go-review.googlesource.com/c/tools/+/417593
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
2022-07-27 18:59:40 +00:00
..
client.go internal/lsp/regtest: simplify, consolidate, and document settings 2022-07-12 16:56:46 +00:00
doc.go internal/lsp/fake: split up and rename the Workspace type 2020-05-06 18:17:57 +00:00
edit.go internal/lsp/cache: don't delete metadata until it's reloaded 2021-06-16 00:19:40 +00:00
edit_test.go internal/lsp/regtest: implement formatting and organizeImports 2020-03-02 19:16:53 +00:00
editor.go internal/lsp/regtest: simplify, consolidate, and document settings 2022-07-12 16:56:46 +00:00
editor_test.go gopls/internal/regtest: add a failing regtest for vscode-go#1489 2021-05-13 13:20:04 +00:00
proxy.go gopls/internal/regtest: add a failing regtest for vscode-go#1489 2021-05-13 13:20:04 +00:00
sandbox.go internal/lsp/cache: report a critical error when go.work is invalid 2022-07-27 18:59:40 +00:00
workdir.go internal/lsp/fake: retry spurious file lock errors on windows 2022-07-12 22:26:41 +00:00
workdir_test.go gopls/internal/regtest: add a failing regtest for vscode-go#1489 2021-05-13 13:20:04 +00:00
workdir_windows.go internal/lsp/fake: retry spurious file lock errors on windows 2022-07-12 22:26:41 +00:00