fix: ignore not go file and go generated error

main
sudo pacman -Syu 2022-11-28 00:58:50 +07:00
parent 6ba5552560
commit 2155c56e16
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 10 additions and 1 deletions

View File

@ -120,7 +120,16 @@ func (ft *Formatter) formatDir(path string) error {
return nil
}
return ft.formatFile(path)
if err := ft.formatFile(path); err != nil {
if errors.Is(err, ErrNotGoFile) ||
errors.Is(err, ErrGoGeneratedFile) {
return nil
}
return err
}
return nil
}); err != nil {
return fmt.Errorf("filepath: failed to walk dir: [%s] %w", path, err)
}