linter: enable nilerr

A number of cases looked suspicious, so I marked them with `FIXME`s to
leave some breadcrumbs.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2022-03-21 14:49:47 +01:00
parent 081e091437
commit 0f12b6fe55
21 changed files with 47 additions and 33 deletions

View File

@@ -99,13 +99,12 @@ func CRRemoveDeletedFiles(id, baseDirectory, containerRootDirectory string) erro
// root file system changes on top of containerRootDirectory
func CRApplyRootFsDiffTar(baseDirectory, containerRootDirectory string) error {
rootfsDiffPath := filepath.Join(baseDirectory, metadata.RootFsDiffTar)
if _, err := os.Stat(rootfsDiffPath); err != nil {
// Only do this if a rootfs-diff.tar actually exists
return nil
}
// Only do this if a rootfs-diff.tar actually exists
rootfsDiffFile, err := os.Open(rootfsDiffPath)
if err != nil {
if os.IsNotExist(err) {
return nil
}
return errors.Wrap(err, "failed to open root file-system diff file")
}
defer rootfsDiffFile.Close()