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-26 01:33:25 +01:00
parent 2825296deb
commit f459796896
27 changed files with 109 additions and 122 deletions
+4 -4
View File
@@ -1,14 +1,14 @@
package container
import (
"errors"
"fmt"
"golang.org/x/net/context"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/pkg/archive"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)
type diffOptions struct {
@@ -32,7 +32,7 @@ func NewDiffCommand(dockerCli *command.DockerCli) *cobra.Command {
func runDiff(dockerCli *command.DockerCli, opts *diffOptions) error {
if opts.container == "" {
return fmt.Errorf("Container name cannot be empty")
return errors.New("Container name cannot be empty")
}
ctx := context.Background()
@@ -51,7 +51,7 @@ func runDiff(dockerCli *command.DockerCli, opts *diffOptions) error {
case archive.ChangeDelete:
kind = "D"
}
fmt.Fprintf(dockerCli.Out(), "%s %s\n", kind, change.Path)
fmt.Fprintln(dockerCli.Out(), kind, change.Path)
}
return nil