Merge pull request #2018 from dolanor/fix-missing-err-check

fix: add full error handling after os.Stat
This commit is contained in:
Andrea Luzzardi 2022-04-05 17:00:03 -07:00 committed by GitHub
commit 893b8dad30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,8 @@ func (t clientFilesystemReadTask) PreRun(_ context.Context, pctx *plancontext.Co
return fmt.Errorf("path %q is not a directory", path) return fmt.Errorf("path %q is not a directory", path)
case pi.IsDir() && !isFS: case pi.IsDir() && !isFS:
return fmt.Errorf("path %q cannot be a directory", path) return fmt.Errorf("path %q cannot be a directory", path)
case err != nil:
return fmt.Errorf("path %q cannot be stat'd: %w", path, err)
} }
if plancontext.IsFSValue(v.Lookup("contents")) { if plancontext.IsFSValue(v.Lookup("contents")) {