Skip to content

Commit

Permalink
internal/test: add more info on GoBuild failures
Browse files Browse the repository at this point in the history
Updates golang/go#59767

Change-Id: I314db4e5837031210fe7b52630898b88d044b7a6
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/560376
Run-TryBot: Zvonimir Pavlinovic <[email protected]>
Reviewed-by: Maceo Thompson <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
zpavlinovic committed Feb 5, 2024
1 parent c28edb3 commit fadf1fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/test/buildtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package test

import (
"errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -75,7 +76,10 @@ func GoBuild(t *testing.T, dir, tags string, strip bool, envVarVals ...string) (
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
t.Fatal(err)
if ee := (*exec.ExitError)(nil); errors.As(err, &ee) && len(ee.Stderr) > 0 {
t.Fatalf("%v: %v\n%s", cmd, err, ee.Stderr)
}
t.Fatalf("%v: %v", cmd, err)
}
return binaryPath + exeSuffix, func() { os.RemoveAll(tmpDir) }
}
Expand Down

0 comments on commit fadf1fa

Please sign in to comment.