mirror of https://github.com/golang/go.git
misc/cgo/testcarchive: fix `go env` error message
Add a missing newline. Don't panic on an unexpected error type. Change-Id: I82a4b12c498fbfdf4972737329631c0c02540005 Reviewed-on: https://go-review.googlesource.com/44092 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
e0e4891827
commit
994b7eebc7
|
|
@ -115,8 +115,10 @@ func init() {
|
||||||
func goEnv(key string) string {
|
func goEnv(key string) string {
|
||||||
out, err := exec.Command("go", "env", key).Output()
|
out, err := exec.Command("go", "env", key).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "go env %s failed:\n%s", key, err)
|
fmt.Fprintf(os.Stderr, "go env %s failed:\n%s\n", key, err)
|
||||||
fmt.Fprintf(os.Stderr, "%s", err.(*exec.ExitError).Stderr)
|
if ee, ok := err.(*exec.ExitError); ok {
|
||||||
|
fmt.Fprintf(os.Stderr, "%s", ee.Stderr)
|
||||||
|
}
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
return strings.TrimSpace(string(out))
|
return strings.TrimSpace(string(out))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue