| 1 | // Copyright 2023 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package testenv |
| 6 | |
| 7 | import ( |
| 8 | "bytes" |
| 9 | "os/exec" |
| 10 | "testing" |
| 11 | ) |
| 12 | |
| 13 | func TestNeedsGo(t *testing.T) { |
| 14 | NeedsGo(t) |
| 15 | out, err := exec.Command("go", "version").Output() |
| 16 | out = bytes.TrimSpace(out) |
| 17 | if err != nil || !bytes.HasPrefix(out, []byte("go version ")) { |
| 18 | t.Errorf("go version failed - %v: %s", err, out) |
| 19 | } |
| 20 | } |