1
0
mirror of https://github.com/golang/go synced 2024-11-18 04:24:47 -07:00

cmd/vet: use testenv

Fix for iOS builder.

Change-Id: I5b6c977b187446c848182a9294d5bed6b5f9f6e4
Reviewed-on: https://go-review.googlesource.com/16633
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
David Crawshaw 2015-11-04 10:41:05 -05:00
parent 8c827c045a
commit dc9ad5861d

View File

@ -2,16 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// No testdata on Android.
// +build !android
package main_test
import (
"bytes"
"flag"
"fmt"
"internal/testenv"
"os"
"os/exec"
"path/filepath"
@ -32,16 +29,11 @@ func TestMain(m *testing.M) {
os.Exit(result)
}
func CanRun() bool {
func MustHavePerl(t *testing.T) {
switch runtime.GOOS {
case "plan9", "windows":
// No Perl installed, can't run errcheck.
return false
case "nacl":
// Minimal and problematic file system.
return false
t.Skipf("skipping test: perl not available on %s", runtime.GOOS)
}
return true
}
var (
@ -53,9 +45,10 @@ func Build(t *testing.T) {
if built {
return
}
if !CanRun() || failed {
testenv.MustHaveGoBuild(t)
MustHavePerl(t)
if failed {
t.Skip("cannot run on this environment")
return
}
cmd := exec.Command("go", "build", "-o", binary)
output, err := cmd.CombinedOutput()