Minor cleanups in cli/command/container

This change does some minor cleanups in the
cli/command/container package;

- sort imports
- replace `fmt.Fprintf()` with `fmt.Fprintln()` if no formatting is used
- replace `fmt.Errorf()` with `errors.New()` if no formatting is used
- remove some redundant `else`'s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2016-12-25 01:05:37 +01:00
parent 2825296deb
commit f459796896
27 changed files with 109 additions and 122 deletions

View File

@ -1,14 +1,14 @@
package container
import (
"errors"
"fmt"
"strings"
"golang.org/x/net/context"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)
type unpauseOptions struct {
@ -39,12 +39,12 @@ func runUnpause(dockerCli *command.DockerCli, opts *unpauseOptions) error {
for _, container := range opts.containers {
if err := <-errChan; err != nil {
errs = append(errs, err.Error())
} else {
fmt.Fprintf(dockerCli.Out(), "%s\n", container)
continue
}
fmt.Fprintln(dockerCli.Out(), container)
}
if len(errs) > 0 {
return fmt.Errorf("%s", strings.Join(errs, "\n"))
return errors.New(strings.Join(errs, "\n"))
}
return nil
}