diff --git a/atom.go b/atom.go index d46cb35..ccbe786 100644 --- a/atom.go +++ b/atom.go @@ -106,13 +106,13 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) { i.Content.Base = tn.S("xml", "base") i.Content.Text = tn.GetValue() } - + if tn = item.SelectNode(ns, "author"); tn != nil { - i.Author = Author{} - i.Author.Name = tn.S(ns, "name") - i.Author.Uri = tn.S(ns, "uri") - i.Author.Email = tn.S(ns, "email") - } + i.Author = Author{} + i.Author.Name = tn.S(ns, "name") + i.Author.Uri = tn.S(ns, "uri") + i.Author.Email = tn.S(ns, "email") + } ch.Items = append(ch.Items, i) } diff --git a/feed.go b/feed.go index 71083e8..4a68c9a 100644 --- a/feed.go +++ b/feed.go @@ -165,7 +165,7 @@ func (this *Feed) makeFeed(doc *xmlx.Document) (err error) { this.CacheTimeout = this.Channels[0].TTL } - return + return } // This function returns true or false, depending on whether the CacheTimeout diff --git a/feed_test.go b/feed_test.go index 4e28eb2..fad7b7f 100644 --- a/feed_test.go +++ b/feed_test.go @@ -1,8 +1,8 @@ package feeder import ( - "testing" "io/ioutil" + "testing" ) var items []*Item @@ -31,9 +31,9 @@ func TestFeed(t *testing.T) { func Test_AtomAuthor(t *testing.T) { content, err := ioutil.ReadFile("testdata/idownload.atom") - if err != nil { + if err != nil { t.Errorf("unable to load file") - } + } feed := New(1, true, chanHandler, itemHandler) err = feed.FetchBytes("http://example.com", content, nil) @@ -45,15 +45,15 @@ func Test_AtomAuthor(t *testing.T) { } func Test_RssAuthor(t *testing.T) { - content, _ := ioutil.ReadFile("testdata/boing.rss") - feed := New(1, true, chanHandler, itemHandler) - feed.FetchBytes("http://example.com", content, nil) + content, _ := ioutil.ReadFile("testdata/boing.rss") + feed := New(1, true, chanHandler, itemHandler) + feed.FetchBytes("http://example.com", content, nil) - item := items[0] - expected := "Cory Doctorow" - if item.Author.Name != expected { - t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name) - } + item := items[0] + expected := "Cory Doctorow" + if item.Author.Name != expected { + t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name) + } } func Test_CData(t *testing.T) { @@ -63,7 +63,7 @@ func Test_CData(t *testing.T) { item := items[0] expected := `
abc