From a6f32d173b161a488cdae51a44e51e3e839ea4d5 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Wed, 30 Sep 2020 11:01:54 -0400 Subject: [PATCH] gopls/internal/regtest: allow cleanup to fail on windows Due to Windows' default file locking and the fact that regtests shell out to the go command, cleanup sometimes fails. This is causing trybot flakes, increasingly as of late. Since the tempdir will eventually be cleaned up on the trybots anyway, don't fail on windows. For golang/go#38490 Change-Id: I136d97143baba1d98777db51daa062cf0e42e33e Reviewed-on: https://go-review.googlesource.com/c/tools/+/258315 Trust: Robert Findley Run-TryBot: Robert Findley gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Rebecca Stambler --- gopls/internal/regtest/reg_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gopls/internal/regtest/reg_test.go b/gopls/internal/regtest/reg_test.go index ced277d240..dfcddbbe53 100644 --- a/gopls/internal/regtest/reg_test.go +++ b/gopls/internal/regtest/reg_test.go @@ -10,6 +10,7 @@ import ( "fmt" "io/ioutil" "os" + "runtime" "testing" "time" @@ -78,11 +79,11 @@ func TestMain(m *testing.M) { code := m.Run() if err := runner.Close(); err != nil { fmt.Fprintf(os.Stderr, "closing test runner: %v\n", err) - // Regtest cleanup is broken in go1.12 and earlier, but this is OK - // for our CI. + // Regtest cleanup is broken in go1.12 and earlier, and sometimes flakes on + // Windows due to file locking, but this is OK for our CI. // - // But fail on go1.13+. - if testenv.Go1Point() >= 13 { + // Fail on non-windows go1.13+. + if testenv.Go1Point() >= 13 && runtime.GOOS != "windows" { os.Exit(1) } }