1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Improve OPML package to be more idiomatic

This commit is contained in:
Frédéric Guillot 2017-11-20 19:11:06 -08:00
parent e91a9b4f13
commit c26787f476
7 changed files with 50 additions and 40 deletions

View file

@ -14,14 +14,14 @@ import (
// Parse reads an OPML file and returns a SubcriptionList.
func Parse(data io.Reader) (SubcriptionList, error) {
opml := new(Opml)
feeds := new(opml)
decoder := xml.NewDecoder(data)
decoder.CharsetReader = charset.NewReaderLabel
err := decoder.Decode(opml)
err := decoder.Decode(feeds)
if err != nil {
return nil, errors.NewLocalizedError("Unable to parse OPML file: %v.", err)
}
return opml.Transform(), nil
return feeds.Transform(), nil
}