// List returns the articles found in the given directory in // the fs argument, recursively. func List(fs vfs.VFS, dir string) ([]*article.Article, error) { files, err := fs.ReadDir(dir) if err != nil { return nil, err } var articles []*article.Article for _, v := range files { p := path.Join(dir, v.Name()) if v.IsDir() { dirArticles, err := List(fs, p) if err != nil { return nil, err } articles = append(articles, dirArticles...) continue } if !extensions[strings.ToLower(path.Ext(p))] { // Not a recognized extension continue } article, err := article.Open(fs, p) if err != nil { return nil, err } articles = append(articles, article) } sortArticles(articles) return articles, nil }