mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
cmd/go/internal/work: log clearer detail for subprocess errors in (*Builder).toolID
For #52647. Change-Id: Ic12123769d339c2df677500ed59f15a4ee5037d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/412954 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
dd2d00f9d5
commit
9e2f289754
|
@ -164,13 +164,16 @@ func (b *Builder) toolID(name string) string {
|
|||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
base.Fatalf("%s: %v\n%s%s", desc, err, stdout.Bytes(), stderr.Bytes())
|
||||
if stderr.Len() > 0 {
|
||||
os.Stderr.Write(stderr.Bytes())
|
||||
}
|
||||
base.Fatalf("go: error obtaining buildID for %s: %v", desc, err)
|
||||
}
|
||||
|
||||
line := stdout.String()
|
||||
f := strings.Fields(line)
|
||||
if len(f) < 3 || f[0] != name && path != VetTool || f[1] != "version" || f[2] == "devel" && !strings.HasPrefix(f[len(f)-1], "buildID=") {
|
||||
base.Fatalf("%s -V=full: unexpected output:\n\t%s", desc, line)
|
||||
base.Fatalf("go: parsing buildID from %s -V=full: unexpected output:\n\t%s", desc, line)
|
||||
}
|
||||
if f[2] == "devel" {
|
||||
// On the development branch, use the content ID part of the build ID.
|
||||
|
|
Loading…
Reference in a new issue