]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/work: log clearer detail for subprocess errors in (*Builder).toolID
authorBryan C. Mills <bcmills@google.com>
Fri, 17 Jun 2022 16:34:30 +0000 (12:34 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 17 Jun 2022 21:21:58 +0000 (21:21 +0000)
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>
src/cmd/go/internal/work/buildid.go

index 846e2c8b775d8e3454fb75d19a5f9331a046b51e..a5b5570e05d047549aa9e653765babeee2025cfd 100644 (file)
@@ -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.