| // Copyright 2023 The Go Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| package testenv | |
| import ( | |
| "bytes" | |
| "os/exec" | |
| "testing" | |
| ) | |
| func TestNeedsGo(t *testing.T) { | |
| NeedsGo(t) | |
| out, err := exec.Command("go", "version").Output() | |
| out = bytes.TrimSpace(out) | |
| if err != nil || !bytes.HasPrefix(out, []byte("go version ")) { | |
| t.Errorf("go version failed - %v: %s", err, out) | |
| } | |
| } |