chore: make fmt.Errorf use %w to wrap error instead of %v (#20350)
This commit is contained in:
@@ -935,18 +935,18 @@ func copyFile(src, dest string) (*os.File, error) {
|
||||
func copyFilesInDir(src, dest string) error {
|
||||
err := os.MkdirAll(dest, 0o750)
|
||||
if err != nil {
|
||||
return fmt.Errorf("mkdirs: %s", err)
|
||||
return fmt.Errorf("mkdirs: %w", err)
|
||||
}
|
||||
fs, err := os.ReadDir(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read dir: %s", err)
|
||||
return fmt.Errorf("read dir: %w", err)
|
||||
}
|
||||
for _, f := range fs {
|
||||
if f.IsDir() {
|
||||
continue
|
||||
}
|
||||
if _, err := copyFile(filepath.Join(src, f.Name()), filepath.Join(dest, f.Name())); err != nil {
|
||||
return fmt.Errorf("copy file: %q: %s", f.Name(), err)
|
||||
return fmt.Errorf("copy file: %q: %w", f.Name(), err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user