cli/command: minor cleanups: use Println, suppress errors
- use Println to print newline instead of custom format - suppress some errors to make my IDE and linters happier Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cd6d902dff
commit
dc5a4501a4
@ -114,7 +114,7 @@ func (cli *DockerCli) CurrentVersion() string {
|
|||||||
// Client returns the APIClient
|
// Client returns the APIClient
|
||||||
func (cli *DockerCli) Client() client.APIClient {
|
func (cli *DockerCli) Client() client.APIClient {
|
||||||
if err := cli.initialize(); err != nil {
|
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)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
return cli.client
|
return cli.client
|
||||||
@ -475,7 +475,7 @@ func (cli *DockerCli) DockerEndpoint() docker.Endpoint {
|
|||||||
if err := cli.initialize(); err != nil {
|
if err := cli.initialize(); err != nil {
|
||||||
// Note that we're not terminating here, as this function may be used
|
// Note that we're not terminating here, as this function may be used
|
||||||
// in cases where we're able to continue.
|
// 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
|
return cli.dockerEndpoint
|
||||||
}
|
}
|
||||||
|
@ -177,19 +177,19 @@ func TestPromptForConfirmation(t *testing.T) {
|
|||||||
return nil
|
return nil
|
||||||
}, promptResult{false, command.ErrPromptTerminated}},
|
}, promptResult{false, command.ErrPromptTerminated}},
|
||||||
{"no", func() error {
|
{"no", func() error {
|
||||||
_, err := fmt.Fprint(promptWriter, "n\n")
|
_, err := fmt.Fprintln(promptWriter, "n")
|
||||||
return err
|
return err
|
||||||
}, promptResult{false, nil}},
|
}, promptResult{false, nil}},
|
||||||
{"yes", func() error {
|
{"yes", func() error {
|
||||||
_, err := fmt.Fprint(promptWriter, "y\n")
|
_, err := fmt.Fprintln(promptWriter, "y")
|
||||||
return err
|
return err
|
||||||
}, promptResult{true, nil}},
|
}, promptResult{true, nil}},
|
||||||
{"any", func() error {
|
{"any", func() error {
|
||||||
_, err := fmt.Fprint(promptWriter, "a\n")
|
_, err := fmt.Fprintln(promptWriter, "a")
|
||||||
return err
|
return err
|
||||||
}, promptResult{false, nil}},
|
}, promptResult{false, nil}},
|
||||||
{"with space", func() error {
|
{"with space", func() error {
|
||||||
_, err := fmt.Fprint(promptWriter, " y\n")
|
_, err := fmt.Fprintln(promptWriter, " y")
|
||||||
return err
|
return err
|
||||||
}, promptResult{true, nil}},
|
}, promptResult{true, nil}},
|
||||||
{"reader closed", func() error {
|
{"reader closed", func() error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user