Runs go fmt on all code.

This commit is contained in:
Jim Teeuwen 2013-11-28 10:23:49 +01:00
parent 29bd83be41
commit 7b1a94122f
4 changed files with 21 additions and 21 deletions

View File

@ -109,10 +109,10 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
if tn = item.SelectNode(ns, "author"); tn != nil { if tn = item.SelectNode(ns, "author"); tn != nil {
i.Author = Author{} i.Author = Author{}
i.Author.Name = tn.S(ns, "name") i.Author.Name = tn.S(ns, "name")
i.Author.Uri = tn.S(ns, "uri") i.Author.Uri = tn.S(ns, "uri")
i.Author.Email = tn.S(ns, "email") i.Author.Email = tn.S(ns, "email")
} }
ch.Items = append(ch.Items, i) ch.Items = append(ch.Items, i)
} }

View File

@ -165,7 +165,7 @@ func (this *Feed) makeFeed(doc *xmlx.Document) (err error) {
this.CacheTimeout = this.Channels[0].TTL this.CacheTimeout = this.Channels[0].TTL
} }
return return
} }
// This function returns true or false, depending on whether the CacheTimeout // This function returns true or false, depending on whether the CacheTimeout

View File

@ -1,8 +1,8 @@
package feeder package feeder
import ( import (
"testing"
"io/ioutil" "io/ioutil"
"testing"
) )
var items []*Item var items []*Item
@ -31,9 +31,9 @@ func TestFeed(t *testing.T) {
func Test_AtomAuthor(t *testing.T) { func Test_AtomAuthor(t *testing.T) {
content, err := ioutil.ReadFile("testdata/idownload.atom") content, err := ioutil.ReadFile("testdata/idownload.atom")
if err != nil { if err != nil {
t.Errorf("unable to load file") t.Errorf("unable to load file")
} }
feed := New(1, true, chanHandler, itemHandler) feed := New(1, true, chanHandler, itemHandler)
err = feed.FetchBytes("http://example.com", content, nil) err = feed.FetchBytes("http://example.com", content, nil)
@ -45,15 +45,15 @@ func Test_AtomAuthor(t *testing.T) {
} }
func Test_RssAuthor(t *testing.T) { func Test_RssAuthor(t *testing.T) {
content, _ := ioutil.ReadFile("testdata/boing.rss") content, _ := ioutil.ReadFile("testdata/boing.rss")
feed := New(1, true, chanHandler, itemHandler) feed := New(1, true, chanHandler, itemHandler)
feed.FetchBytes("http://example.com", content, nil) feed.FetchBytes("http://example.com", content, nil)
item := items[0] item := items[0]
expected := "Cory Doctorow" expected := "Cory Doctorow"
if item.Author.Name != expected { if item.Author.Name != expected {
t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name) t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name)
} }
} }
func Test_CData(t *testing.T) { func Test_CData(t *testing.T) {
@ -63,7 +63,7 @@ func Test_CData(t *testing.T) {
item := items[0] item := items[0]
expected := `<p>abc<div>"def"</div>ghi` expected := `<p>abc<div>"def"</div>ghi`
if item.Description != expected { if item.Description != expected {
t.Errorf("Expected item.Description to be [%s] but item.Description=[%s]", expected, item.Description) t.Errorf("Expected item.Description to be [%s] but item.Description=[%s]", expected, item.Description)
} }
} }
@ -73,6 +73,6 @@ func chanHandler(feed *Feed, newchannels []*Channel) {
} }
func itemHandler(feed *Feed, ch *Channel, newitems []*Item) { func itemHandler(feed *Feed, ch *Channel, newitems []*Item) {
items = newitems items = newitems
println(len(newitems), "new item(s) in", ch.Title, "of", feed.Url) println(len(newitems), "new item(s) in", ch.Title, "of", feed.Url)
} }