His example criticizing errors in `rootInfo` func is silly. There is utterly no need to do a `strings.HasSuffix(err.Error(), "not a directory")`.
func rootInfo(root, p string) (has bool, isDir bool, err error) {
p = path.Clean(p)
info, err := os.Stat(root + "/" + p)
if info != nil {
has, isDir = true, info.IsDir()
return
}
if errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.ENOTDIR) {
err = nil
}
return
}