Browse Source

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>
Kir Kolyshkin 6 years ago
parent
commit
58ac4bd938
1 changed files with 3 additions and 3 deletions
  1. 3 3
      daemon/checkpoint.go

+ 3 - 3
daemon/checkpoint.go

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