code cleanup

clean up code identified as problematic by golands inspection

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-07-03 15:37:17 -05:00
parent f7407f2eb5
commit 1d36501f96
19 changed files with 122 additions and 140 deletions

View File

@ -430,22 +430,17 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool,
// If we're removing the pod, the container will be evicted
// from the state elsewhere
if !removePod {
if err := r.state.RemoveContainerFromPod(pod, c); err != nil {
if cleanupErr == nil {
cleanupErr = err
} else {
logrus.Errorf("removing container from pod: %v", err)
}
if cleanupErr == nil {
cleanupErr = err
} else {
logrus.Errorf("removing container from pod: %v", err)
}
}
} else {
if err := r.state.RemoveContainer(c); err != nil {
if cleanupErr == nil {
cleanupErr = err
} else {
logrus.Errorf("removing container: %v", err)
}
cleanupErr = err
}
logrus.Errorf("removing container: %v", err)
}
// Set container as invalid so it can no longer be used