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 <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/gopls/internal/regtest/reg_test.go b/gopls/internal/regtest/reg_test.go
index ced277d..dfcddbb 100644
--- a/gopls/internal/regtest/reg_test.go
+++ b/gopls/internal/regtest/reg_test.go
@@ -10,6 +10,7 @@
 	"fmt"
 	"io/ioutil"
 	"os"
+	"runtime"
 	"testing"
 	"time"
 
@@ -78,11 +79,11 @@
 	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)
 		}
 	}