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,18 +1,17 @@
package container
import (
"fmt"
"errors"
"io"
"net/http/httputil"
"golang.org/x/net/context"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/pkg/signal"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)
type attachOptions struct {
@ -54,11 +53,11 @@ func runAttach(dockerCli *command.DockerCli, opts *attachOptions) error {
}
if !c.State.Running {
return fmt.Errorf("You cannot attach to a stopped container, start it first")
return errors.New("You cannot attach to a stopped container, start it first")
}
if c.State.Paused {
return fmt.Errorf("You cannot attach to a paused container, unpause it first")
return errors.New("You cannot attach to a paused container, unpause it first")
}
if err := dockerCli.In().CheckTty(!opts.noStdin, c.Config.Tty); err != nil {