diff --git a/go/analysis/analysistest/analysistest_test.go b/go/analysis/analysistest/analysistest_test.go index 30704c2a..5456fd9d 100644 --- a/go/analysis/analysistest/analysistest_test.go +++ b/go/analysis/analysistest/analysistest_test.go @@ -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,