From b0a6c2aa3ffab510cfbaab441e32f881cfe224b6 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Thu, 12 Sep 2019 02:42:35 -0400 Subject: [PATCH] internal/testenv: handle GOPACKAGESDRIVER=off in NeedsGopackage This was causing tests to report that they required a binary called "off". Change-Id: I592109029c86af20d48d2ee9989d4a25fdb11b3d Reviewed-on: https://go-review.googlesource.com/c/tools/+/194978 Run-TryBot: Rebecca Stambler Reviewed-by: Michael Matloob --- internal/testenv/testenv.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/testenv/testenv.go b/internal/testenv/testenv.go index 6b8ce90ddc..7d8de1a1e9 100644 --- a/internal/testenv/testenv.go +++ b/internal/testenv/testenv.go @@ -75,7 +75,11 @@ func NeedsGoPackages(t Testing) { } tool := os.Getenv("GOPACKAGESDRIVER") - if tool == "" { + switch tool { + case "off": + // "off" forces go/packages to use the go command. + tool = "go" + case "": if _, err := exec.LookPath("gopackagesdriver"); err == nil { tool = "gopackagesdriver" } else {