Skip to content

Commit 9a6582c

Browse files
committed
gopls/internal/regtest: avoid flake in TestGoModInvalidesOnSave
Investigating flakes in TestGoModInvalidatesOnSave highlighted a couple bugs: + A didOpen on a go.mod file invalidates the workspace, since it is treated as a saved change. This, in itself, is probably not such a big deal, except that... + When metadata is deleted on this didOpen, we break the workspace before it can be recomputed. Fix this by awaiting diagnostics from the didOpen, but it would be better to have a more robust fix (e.g. CL 271477). For golang/go#43554 Change-Id: I75d49b818ae2f3730a48ac6a473c24c664227523 Reviewed-on: https://go-review.googlesource.com/c/tools/+/283352 Run-TryBot: Robert Findley <[email protected]> Trust: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent f618651 commit 9a6582c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

gopls/internal/regtest/modfile_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ func hello() {}
828828
Modes(Singleton),
829829
).run(t, mod, func(t *testing.T, env *Env) {
830830
env.OpenFile("go.mod")
831+
env.Await(CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1))
831832
env.RegexpReplace("go.mod", "module", "modul")
832833
// Confirm that we still have metadata with only on-disk edits.
833834
env.OpenFile("main.go")

0 commit comments

Comments
 (0)