mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
32 lines
491 B
Go
32 lines
491 B
Go
package cleanup
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
func Cleanup(path string) error {
|
|
return filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
|
|
fmt.Println(path)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if strings.Contains(path, "vendor") {
|
|
return filepath.SkipDir
|
|
}
|
|
|
|
if strings.HasPrefix(info.Name(), "zz_generated") {
|
|
fmt.Println("Removing", path)
|
|
if err := os.Remove(path); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
})
|
|
}
|