MCPcopy Index your code
hub / github.com/coder/coder / deleteEmptyDirs

Function deleteEmptyDirs

scripts/clidocgen/main.go:58–79  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

56}
57
58func deleteEmptyDirs(dir string) error {
59 return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
60 if err != nil {
61 return err
62 }
63 if !info.IsDir() {
64 return nil
65 }
66 ents, err := os.ReadDir(path)
67 if err != nil {
68 return err
69 }
70 if len(ents) == 0 {
71 flog.Infof("deleting empty dir\t %v", path)
72 err = os.Remove(path)
73 if err != nil {
74 return err
75 }
76 }
77 return nil
78 })
79}
80
81func main() {
82 prepareEnv()

Callers 1

mainFunction · 0.85

Calls 3

ReadDirMethod · 0.80
InfofMethod · 0.80
RemoveMethod · 0.65

Tested by

no test coverage detected