diff --git a/cli/command/cli.go b/cli/command/cli.go index 722901e060..a8cfd58e4d 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -114,7 +114,7 @@ func (cli *DockerCli) CurrentVersion() string { // Client returns the APIClient func (cli *DockerCli) Client() client.APIClient { if err := cli.initialize(); err != nil { - _, _ = fmt.Fprintf(cli.Err(), "Failed to initialize: %s\n", err) + _, _ = fmt.Fprintln(cli.Err(), "Failed to initialize:", err) os.Exit(1) } return cli.client @@ -475,7 +475,7 @@ func (cli *DockerCli) DockerEndpoint() docker.Endpoint { if err := cli.initialize(); err != nil { // Note that we're not terminating here, as this function may be used // in cases where we're able to continue. - _, _ = fmt.Fprintf(cli.Err(), "%v\n", cli.initErr) + _, _ = fmt.Fprintln(cli.Err(), cli.initErr) } return cli.dockerEndpoint } diff --git a/cli/command/utils_test.go b/cli/command/utils_test.go index a940d876a1..4537cfcd58 100644 --- a/cli/command/utils_test.go +++ b/cli/command/utils_test.go @@ -177,19 +177,19 @@ func TestPromptForConfirmation(t *testing.T) { return nil }, promptResult{false, command.ErrPromptTerminated}}, {"no", func() error { - _, err := fmt.Fprint(promptWriter, "n\n") + _, err := fmt.Fprintln(promptWriter, "n") return err }, promptResult{false, nil}}, {"yes", func() error { - _, err := fmt.Fprint(promptWriter, "y\n") + _, err := fmt.Fprintln(promptWriter, "y") return err }, promptResult{true, nil}}, {"any", func() error { - _, err := fmt.Fprint(promptWriter, "a\n") + _, err := fmt.Fprintln(promptWriter, "a") return err }, promptResult{false, nil}}, {"with space", func() error { - _, err := fmt.Fprint(promptWriter, " y\n") + _, err := fmt.Fprintln(promptWriter, " y") return err }, promptResult{true, nil}}, {"reader closed", func() error {