tools/cmd/vet: check that cgo is enabled before testing it

Should fix the tools builders.

LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/176530043
This commit is contained in:
Rob Pike 2014-12-02 08:15:26 +09:00
parent 9393b17080
commit 0e9050009a
1 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,7 @@ package main
import (
"fmt"
"go/build"
"io"
"io/ioutil"
"os"
@ -45,6 +46,10 @@ func TestEndToEnd(t *testing.T) {
t.Errorf("%s is not a Go file", name)
continue
}
if name == "cgo.go" && !build.Default.CgoEnabled {
t.Logf("cgo is no enabled for %s", name)
continue
}
// Names are known to be ASCII and long enough.
typeName := fmt.Sprintf("%c%s", name[0]+'A'-'a', name[1:len(name)-len(".go")])
stringerCompileAndRun(t, dir, stringer, typeName, name)