go/internal
Bryan C. Mills 82366c6960 internal/lsp/fake: in WriteFileData, retry writes that fail with ERROR_LOCK_VIOLATION on Windows
The 'go' command reads the main module's 'go.mod' file with the file
locked. If 'gopls' starts a 'go' command in the background that reads
the 'go.mod' file, there is a narrow window in which that read can
race with the test's ioutil.WriteFile.

This change retries the write (as a user would probably do), fixing
the test failure. However, I suspect that there may be a broader UX
issue here that it will mask: in order to actually avoid the race
without a locking error, something in the LSP protocol needs to be
synchronizing gopls-initiated reads with editor-initiated writes. The
test failure this fixes indicates that that synchronization seems not
to be happening.

Fixes golang/go#50971

Change-Id: Iba140277bf957bae4937cc23f62d3aac817a7d36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382414
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-02-03 05:58:33 +00:00
..
analysisinternal
apidiff all: add copyright notices to files that are missing them 2021-01-06 17:23:47 +00:00
event internal/lsp/debug: add a facility to track known bugs 2021-05-10 23:21:19 +00:00
fakenet
fastwalk x/tools/internal/fastwalk: fixes "interrupted system call" error 2021-02-24 01:32:32 +00:00
gocommand internal/gocommand: run 'go list' on the unsafe package when fetching release tags 2021-05-29 00:21:43 +00:00
gopathwalk
imports internal/imports: avoid rare panic 2022-01-11 14:03:54 +00:00
jsonrpc2 internal/jsonrpc2: make Serve wait for all connections to close 2021-11-08 20:32:21 +00:00
jsonrpc2_v2 internal/lsp/lsprpc: update binder tests to handle forwarding 2021-06-25 19:21:47 +00:00
lsp internal/lsp/fake: in WriteFileData, retry writes that fail with ERROR_LOCK_VIOLATION on Windows 2022-02-03 05:58:33 +00:00
memoize internal/memoize: do not allow (*Generation).Acquire to fail 2021-12-02 03:25:35 +00:00
mod internal/mod: add workfile parser 2021-06-24 04:20:08 +00:00
packagesinternal internal/lsp/cache: disable network for mod tidy diagnostics 2021-02-05 19:41:14 +00:00
proxydir
span internal/span: fix a comment about windows drive letters 2021-08-03 19:59:22 +00:00
stack
testenv gopls/internal/regtest/codelens: use the test's deadline instead of a hard-coded timeout 2022-01-24 16:28:24 +00:00
tool gopls: cleanup the main help pages 2022-02-02 14:57:28 +00:00
typeparams internal/typeparams/example: start adding a guide to generics for tools 2022-01-22 21:07:13 +00:00
typesinternal internal/typesinternal: document ReadGo116ErrorData 2021-09-21 03:32:29 +00:00
xcontext