package fs import ( "errors" "io/fs" ) func isNotFound(err error) bool { if err == nil { return false } var pathErr *fs.PathError if errors.As(err, &pathErr) { e := pathErr.Err return errors.Is(e, fs.ErrInvalid) || errors.Is(e, fs.ErrNotExist) } return false } func fileIsDir(file fs.File) (bool, error) { info, err := file.Stat() if err != nil { return false, err } return info.IsDir(), nil }