func (dw *DirWatcher) unmapSubdirs(node *memfs.Node) {
	for _, child := range node.Childs {
		if !child.IsDir() {
			continue
		}
		delete(dw.dirs, child.Path)
		dw.unmapSubdirs(child)
	}
}
unmapSubdirs find any sub directories in node's childrens and remove it
from map of node.
package io
import (
	"fmt"
	"log"
	"os"
	"time"
	"github.com/shuLhan/share/lib/debug"
	"github.com/shuLhan/share/lib/memfs"
)
type DirWatcher struct {
	memfs.Options
	Delay time.Duration
	Callback WatchCallback
	dirs map[string]*memfs.Node
	root   *memfs.Node
	fs     *memfs.MemFS
	ticker *time.Ticker
}
func (dw *DirWatcher) Start() (err error) {
	logp := "DirWatcher.Start"
	if dw.Delay < 100*time.Millisecond {
		dw.Delay = time.Second * 5
	}
	if dw.Callback == nil {
		return fmt.Errorf("%s: callback is not defined", logp)
	}
	fi, err := os.Stat(dw.Root)
	if err != nil {
		return fmt.Errorf("%s: %w", logp, err)
	}
	if !fi.IsDir() {
		return fmt.Errorf("%s: %q is not a directory", logp, dw.Root)
	}
	dw.Options.MaxFileSize = -1
	dw.fs, err = memfs.New(&dw.Options)
	if err != nil {
		return fmt.Errorf("%s: %w", logp, err)
	}
	dw.root = dw.fs.Root
	dw.dirs = make(map[string]*memfs.Node)
	dw.mapSubdirs(dw.root)
	go dw.start()
	return nil
}
func (dw *DirWatcher) Stop() {
	dw.ticker.Stop()
}
func (dw *DirWatcher) mapSubdirs(node *memfs.Node) {
	var (
		logp = "DirWatcher.mapSubdirs"
		err  error
	)
	for _, child := range node.Childs {
		if child.IsDir() {
			dw.dirs[child.Path] = child
			dw.mapSubdirs(child)
			continue
		}
		_, err = newWatcher(node, child, dw.Delay, dw.Callback)
		if err != nil {
			log.Printf("%s: %q: %s", logp, child.SysPath, err)
		}
	}
}