]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/testcarchive: fix `go env` error message
authorIan Lance Taylor <iant@golang.org>
Wed, 24 May 2017 21:59:22 +0000 (14:59 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 24 May 2017 22:27:16 +0000 (22:27 +0000)
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>
misc/cgo/testcarchive/carchive_test.go

index dbde92d7446fca5912ad1954e7366a666250e2da..74897c7f6f1fb719c1642c657b88a1d1e4023c16 100644 (file)
@@ -115,8 +115,10 @@ func init() {
 func goEnv(key string) string {
        out, err := exec.Command("go", "env", key).Output()
        if err != nil {
-               fmt.Fprintf(os.Stderr, "go env %s failed:\n%s", key, err)
-               fmt.Fprintf(os.Stderr, "%s", err.(*exec.ExitError).Stderr)
+               fmt.Fprintf(os.Stderr, "go env %s failed:\n%s\n", key, err)
+               if ee, ok := err.(*exec.ExitError); ok {
+                       fmt.Fprintf(os.Stderr, "%s", ee.Stderr)
+               }
                os.Exit(2)
        }
        return strings.TrimSpace(string(out))