xref: /aosp_15_r20/external/toolchain-utils/go/patch/go-1.10.2/go0.patch (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1testenv: look for "go" executable in path.
2
3--- src/go/build/deps_test.go
4+++ src/go/build/deps_test.go
5@@ -182,17 +182,17 @@ var pkgDeps = map[string][]string{
6 	"runtime/debug":  {"L2", "fmt", "io/ioutil", "os", "time"},
7 	"runtime/pprof":  {"L2", "compress/gzip", "context", "encoding/binary", "fmt", "io/ioutil", "os", "text/tabwriter", "time"},
8 	"runtime/trace":  {"L0"},
9 	"text/tabwriter": {"L2"},
10
11 	"testing":          {"L2", "flag", "fmt", "internal/race", "os", "runtime/debug", "runtime/pprof", "runtime/trace", "time"},
12 	"testing/iotest":   {"L2", "log"},
13 	"testing/quick":    {"L2", "flag", "fmt", "reflect", "time"},
14-	"internal/testenv": {"L2", "OS", "flag", "testing", "syscall"},
15+	"internal/testenv": {"L2", "OS", "os/exec", "flag", "testing", "syscall"},
16
17 	// L4 is defined as L3+fmt+log+time, because in general once
18 	// you're using L3 packages, use of fmt, log, or time is not a big deal.
19 	"L4": {
20 		"L3",
21 		"fmt",
22 		"log",
23 		"time",
24--- src/internal/testenv/testenv.go
25+++ src/internal/testenv/testenv.go
26@@ -43,16 +43,19 @@ func HasGoBuild() bool {
27 	switch runtime.GOOS {
28 	case "android", "nacl":
29 		return false
30 	case "darwin":
31 		if strings.HasPrefix(runtime.GOARCH, "arm") {
32 			return false
33 		}
34 	}
35+	if _, err := exec.LookPath("go"); err != nil {
36+		return false
37+	}
38 	return true
39 }
40
41 // MustHaveGoBuild checks that the current system can build programs with ``go build''
42 // and then run them with os.StartProcess or exec.Command.
43 // If not, MustHaveGoBuild calls t.Skip with an explanation.
44 func MustHaveGoBuild(t testing.TB) {
45 	if os.Getenv("GO_GCFLAGS") != "" {
46