()
| 12 | ) |
| 13 | |
| 14 | func Example() { |
| 15 | w := watcher.NewWatcher("/path/to/dir", func(e *watcher.Event) { |
| 16 | slog.Info("filesystem event", "event", e) |
| 17 | }) |
| 18 | defer w.Close() |
| 19 | |
| 20 | // Wait for a new line to exit |
| 21 | _, _ = fmt.Scanln() |
| 22 | } |
| 23 | |
| 24 | func TestWatcher(t *testing.T) { |
| 25 | dir := t.TempDir() |