// MustHaveGoBuild checks that the current system can build programs with ``go build'' // and then run them with os.StartProcess or exec.Command. // If not, MustHaveGoBuild calls t.Skip with an explanation. public static void MustHaveGoBuild(testing.TB t) { if (os.Getenv("GO_GCFLAGS") != "") { t.Skipf("skipping test: 'go build' not compatible with setting $GO_GCFLAGS"); } if (!HasGoBuild()) { t.Skipf("skipping test: 'go build' not available on %s/%s", runtime.GOOS, runtime.GOARCH); } }
// MustHaveGoRun checks that the current system can run programs with ``go run.'' // If not, MustHaveGoRun calls t.Skip with an explanation. public static void MustHaveGoRun(testing.TB t) { if (!HasGoRun()) { t.Skipf("skipping test: 'go run' not available on %s/%s", runtime.GOOS, runtime.GOARCH); } }