check for filepath.Walk error everywhere

This commit is contained in:
Tejal Desai 2020-02-28 04:23:27 -08:00
parent 7aa737c297
commit 17f808da8a
2 changed files with 8 additions and 1 deletions

View File

@ -62,6 +62,9 @@ func setupTestTemp() string {
}
cperr := filepath.Walk(srcPath,
func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if path != srcPath {
if err != nil {
return err

View File

@ -188,7 +188,11 @@ func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, e
// DeleteFilesystem deletes the extracted image file system
func DeleteFilesystem() error {
logrus.Info("Deleting filesystem...")
return filepath.Walk(constants.RootDir, func(path string, info os.FileInfo, _ error) error {
return filepath.Walk(constants.RootDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return errors.Wrap(err, fmt.Sprintf("walking path %s", path))
}
if CheckWhitelist(path) {
if !isExist(path) {
logrus.Debugf("Path %s whitelisted, but not exists", path)