INNER CODE UNIT · Go
runMain
xo/usql · cli_test.go:46
func runMain(m *testing.M) (int, error) {
if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
// Nothing to build, because Record cannot run here. The tests
// themselves report the skip, so that the reason is visible.
return m.Run(), nil
}
dir, err := os.MkdirTemp("", "usql-cli-")
if err != nil {
return 0, fmt.Errorf("creating build directory: %w", err)
}
defer func() { _ = os.RemoveAll(dir) }()
usqlPath = filepath.Join(dir, "usql")
cmd := exec.Command("go", "build", "-tags", buildTags, "-o", usqlPath, ".")
if out, err := cmd.CombinedOutput(); err != nil {
return 0, fmt.Errorf("building usql: %w\n%s", err, out)
}
return m.Run(), nil
}