chore: update to use WalkDir
This commit is contained in:
parent
6613f4f880
commit
30ea7a4ec4
5
main.go
5
main.go
@ -30,7 +30,7 @@ func main() {
|
|||||||
|
|
||||||
switch flag.Arg(0) {
|
switch flag.Arg(0) {
|
||||||
case "normalize":
|
case "normalize":
|
||||||
err := filepath.Walk(*path, normalize)
|
err := filepath.WalkDir(*path, normalize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -91,10 +91,11 @@ func removeSuffix(suffix string) filepath.WalkFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalize(p string, f os.FileInfo, err error) error {
|
func normalize(p string, f os.DirEntry, err error) error {
|
||||||
if f == nil {
|
if f == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
filename := f.Name()
|
filename := f.Name()
|
||||||
if skip, err := skipDir(filename); skip {
|
if skip, err := skipDir(filename); skip {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user