Commit 994b7eeb authored by Ian Lance Taylor's avatar Ian Lance Taylor

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent e0e48918
...@@ -115,8 +115,10 @@ func init() { ...@@ -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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment