(dir string)
| 103 | } |
| 104 | |
| 105 | func (d *naiveNotify) watchRecursively(dir string) error { |
| 106 | if d.isWatcherRecursive { |
| 107 | err := d.add(dir) |
| 108 | if err == nil || os.IsNotExist(err) { |
| 109 | return nil |
| 110 | } |
| 111 | return fmt.Errorf("watcher.Add(%q): %w", dir, err) |
| 112 | } |
| 113 | |
| 114 | return filepath.WalkDir(dir, func(path string, info fs.DirEntry, err error) error { |
| 115 | if err != nil { |
| 116 | return err |
| 117 | } |
| 118 | |
| 119 | if !info.IsDir() { |
| 120 | return nil |
| 121 | } |
| 122 | |
| 123 | if d.shouldSkipDir(path) { |
| 124 | logrus.Debugf("Ignoring directory and its contents (recursively): %s", path) |
| 125 | return filepath.SkipDir |
| 126 | } |
| 127 | |
| 128 | err = d.add(path) |
| 129 | if err != nil { |
| 130 | if os.IsNotExist(err) { |
| 131 | return nil |
| 132 | } |
| 133 | return fmt.Errorf("watcher.Add(%q): %w", path, err) |
| 134 | } |
| 135 | return nil |
| 136 | }) |
| 137 | } |
| 138 | |
| 139 | func (d *naiveNotify) Close() error { |
| 140 | numberOfWatches.Add(-d.numWatches) |
no test coverage detected