From 140737fa61ecd083e4967b36551743e4d3c4600f Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 3 Oct 2018 14:31:06 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Michael Matloob --- go/analysis/analysistest/analysistest_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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,