From 9e9211a98eaaa68d7daee70aabe3d1d28f421525 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Tue, 16 Mar 2021 14:09:21 -0400 Subject: [PATCH] gopls/internal/regtest: fix race when printing regtest state on falure Change-Id: Ia4d36510d5929789f045480a22e4e6c20d3c96c5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/302289 Trust: Robert Findley Run-TryBot: Robert Findley gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Heschi Kreinick --- gopls/internal/regtest/env.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gopls/internal/regtest/env.go b/gopls/internal/regtest/env.go index 322799d68c..3c41066024 100644 --- a/gopls/internal/regtest/env.go +++ b/gopls/internal/regtest/env.go @@ -282,8 +282,9 @@ func (e *Env) Await(expectations ...Expectation) { e.mu.Unlock() return case Unmeetable: + failure := fmt.Sprintf("unmeetable expectations:\n%s\nstate:\n%v", summary, e.state) e.mu.Unlock() - e.T.Fatalf("unmeetable expectations:\n%s\nstate:\n%v", summary, e.state) + e.T.Fatal(failure) } cond := &condition{ expectations: expectations,