getFile: print exact error from os.Stat (MR 28)

Pass the exact error message down and make formatting of the message
consistent.
This commit is contained in:
Oliver Smith
2023-01-11 19:15:29 +01:00
committed by Clayton Craft
parent 0c0a85f3bb
commit 112b572dc2

View File

@@ -275,7 +275,7 @@ func getFile(file string, required bool) (files []string, err error) {
fileInfo, err := os.Stat(file) fileInfo, err := os.Stat(file)
if err != nil { if err != nil {
if required { if required {
return files, errors.New("getFile: File does not exist :" + file) return files, fmt.Errorf("getFile: failed to stat file %q: %w", file, err)
} }
return files, nil return files, nil
} }