internal/processtest: output a better error message when failing to compile a Go program

This commit is contained in:
Hajime Hoshi 2023-04-01 04:01:39 +09:00
parent 2875eb25f1
commit 0d1f990338

View File

@ -78,8 +78,8 @@ func TestPrograms(t *testing.T) {
defer m.Unlock() defer m.Unlock()
bin := filepath.Join(tmpdir, n) bin := filepath.Join(tmpdir, n)
if err := exec.Command("go", "build", "-o", bin, filepath.Join(dir, n)).Run(); err != nil { if out, err := exec.Command("go", "build", "-o", bin, filepath.Join(dir, n)).CombinedOutput(); err != nil {
t.Fatal(err) t.Fatalf("%v\n%s", err, string(out))
} }
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) ctx, cancel := context.WithTimeout(context.Background(), time.Minute)