瀏覽代碼

daemon/monitor: rm redundant if

The last check for err != nil is not needed as err is always non-nil
there. Remove the check.

Also, no need to explicitly define `var err error` here.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Kir Kolyshkin 6 年之前
父節點
當前提交
3ef7f7c650
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      daemon/monitor.go

+ 3 - 5
daemon/monitor.go

@@ -202,15 +202,13 @@ func (daemon *Daemon) autoRemove(c *container.Container) {
 		return
 		return
 	}
 	}
 
 
-	var err error
-	if err = daemon.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err == nil {
+	err := daemon.ContainerRm(c.ID, &types.ContainerRmConfig{ForceRemove: true, RemoveVolume: true})
+	if err == nil {
 		return
 		return
 	}
 	}
 	if c := daemon.containers.Get(c.ID); c == nil {
 	if c := daemon.containers.Get(c.ID); c == nil {
 		return
 		return
 	}
 	}
 
 
-	if err != nil {
-		logrus.WithError(err).WithField("container", c.ID).Error("error removing container")
-	}
+	logrus.WithError(err).WithField("container", c.ID).Error("error removing container")
 }
 }