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:
committed by
Clayton Craft
parent
0c0a85f3bb
commit
112b572dc2
2
main.go
2
main.go
@@ -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
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user