1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

daemon/checkpoint: rm extra checks

In this code, err is already checked to be nil (or non-nil), so no need
to repeat extra checks.

Fixes the following govet warnings:

> daemon/checkpoint.go:38:12: nilness: tautological condition: nil == nil (govet)
> 		case err == nil:
> 		         ^
> daemon/checkpoint.go:45:12: nilness: tautological condition: nil == nil (govet)
> 		case err == nil && stat.IsDir():
> 		         ^
> daemon/checkpoint.go:47:12: nilness: tautological condition: nil == nil (govet)
> 		case err == nil:
> 		         ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2019-08-05 16:59:33 -07:00 committed by Sebastiaan van Stijn
parent 3ef7f7c650
commit 58ac4bd938
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -35,16 +35,16 @@ func getCheckpointDir(checkDir, checkpointID, ctrName, ctrID, ctrCheckpointDir s
err2 = os.MkdirAll(checkpointAbsDir, 0700)
case err != nil:
err2 = err
case err == nil:
default:
err2 = fmt.Errorf("%s exists and is not a directory", checkpointAbsDir)
}
} else {
switch {
case err != nil:
err2 = fmt.Errorf("checkpoint %s does not exist for container %s", checkpointID, ctrName)
case err == nil && stat.IsDir():
case stat.IsDir():
err2 = nil
case err == nil:
default:
err2 = fmt.Errorf("%s exists and is not a directory", checkpointAbsDir)
}
}