sweet/common: include stderr in error string

We use cmd.Output in order to capture stderr, but ExitError.Error
doesn't actually include stderr in the string. Create a wrapper error
that does so.

For golang/go#51445.

Change-Id: I5101389c758897e96faa74ef49e9800db1758586
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/389774
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
diff --git a/sweet/common/gotool.go b/sweet/common/gotool.go
index 20fc76c..b86c6d0 100644
--- a/sweet/common/gotool.go
+++ b/sweet/common/gotool.go
@@ -43,6 +43,11 @@
 	}
 	// Use cmd.Output to get an ExitError with Stderr populated.
 	_, err := cmd.Output()
+	if ee, ok := err.(*exec.ExitError); ok {
+		// ExitError includes stderr, but doesn't inclue it in Error.
+		// Create a new error that does display stderr.
+		return fmt.Errorf("%w. stderr:\n%s", err, ee.Stderr)
+	}
 	return err
 }