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:
parent
8e930c1793
commit
140737fa61
|
@ -2,6 +2,8 @@ package analysistest_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -10,6 +12,18 @@ import (
|
||||||
"golang.org/x/tools/go/analysis/passes/findcall"
|
"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.
|
// TestTheTest tests the analysistest testing infrastructure.
|
||||||
func TestTheTest(t *testing.T) {
|
func TestTheTest(t *testing.T) {
|
||||||
// We'll simulate a partly failing test of the findcall analysis,
|
// We'll simulate a partly failing test of the findcall analysis,
|
||||||
|
|
Loading…
Reference in New Issue