Skip to content

Commit

Permalink
:= / var
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Victor Vieux <[email protected]> (github: vieux)
  • Loading branch information
vieux committed Feb 25, 2014
1 parent e7cc88c commit c7f825c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,10 @@ func (cli *DockerCli) CmdPort(args ...string) error {

// 'docker rmi IMAGE' removes all images with the name IMAGE
func (cli *DockerCli) CmdRmi(args ...string) error {
cmd := cli.Subcmd("rmi", "IMAGE [IMAGE...]", "Remove one or more images")
force := cmd.Bool([]string{"f", "-force"}, false, "Force")
var (
cmd = cli.Subcmd("rmi", "IMAGE [IMAGE...]", "Remove one or more images")
force = cmd.Bool([]string{"f", "-force"}, false, "Force")
)
if err := cmd.Parse(args); err != nil {
return nil
}
Expand Down
7 changes: 3 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1812,10 +1812,10 @@ func (srv *Server) ContainerDestroy(job *engine.Job) engine.Status {
func (srv *Server) DeleteImage(name string, imgs *engine.Table, first, force bool) error {
var (
repoName, tag string
img, err = srv.runtime.repositories.LookupImage(name)
tags = []string{}
)

img, err := srv.runtime.repositories.LookupImage(name)
if err != nil {
return fmt.Errorf("No such image: %s", name)
}
Expand Down Expand Up @@ -1873,8 +1873,7 @@ func (srv *Server) DeleteImage(name string, imgs *engine.Table, first, force boo
if err := srv.runtime.repositories.DeleteAll(img.ID); err != nil {
return err
}
err := srv.runtime.graph.Delete(img.ID)
if err != nil {
if err := srv.runtime.graph.Delete(img.ID); err != nil {
return err
}
out := &engine.Env{}
Expand All @@ -1898,7 +1897,7 @@ func (srv *Server) ImageDelete(job *engine.Job) engine.Status {
if n := len(job.Args); n != 1 {
return job.Errorf("Usage: %s IMAGE", job.Name)
}
var imgs = engine.NewTable("", 0)
imgs := engine.NewTable("", 0)
if err := srv.DeleteImage(job.Args[0], imgs, true, job.GetenvBool("force")); err != nil {
return job.Error(err)
}
Expand Down
6 changes: 4 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,10 @@ func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser {
}

func CompareVersion(a, b string) int {
aa := strings.Split(a, ".")
bb := strings.Split(b, ".")
var (
aa = strings.Split(a, ".")
bb = strings.Split(b, ".")
)
for i, s := range aa {
var ai, bi int
ai, _ = strconv.Atoi(s)
Expand Down

0 comments on commit c7f825c

Please sign in to comment.