go/analysis/analysistest: set GO111MODULE=off in TestTheTest

This fixes 'go test ./...' in the root of the tools repo with GO111MODULE=on.

Updates golang/go#27858

Change-Id: I7492d2a2406997a399fe2badd24882fcb19d37c5
Reviewed-on: https://go-review.googlesource.com/c/139320
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Bryan C. Mills 2018-10-03 14:31:06 -04:00
parent 8e930c1793
commit 140737fa61
1 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,8 @@ package analysistest_test
import (
"fmt"
"log"
"os"
"reflect"
"strings"
"testing"
@ -10,6 +12,18 @@ import (
"golang.org/x/tools/go/analysis/passes/findcall"
)
func init() {
// This test currently requires GOPATH mode.
// Explicitly disabling module mode should suffix, but
// we'll also turn off GOPROXY just for good measure.
if err := os.Setenv("GO111MODULE", "off"); err != nil {
log.Fatal(err)
}
if err := os.Setenv("GOPROXY", "off"); err != nil {
log.Fatal(err)
}
}
// TestTheTest tests the analysistest testing infrastructure.
func TestTheTest(t *testing.T) {
// We'll simulate a partly failing test of the findcall analysis,