diff --git a/atom.go b/atom.go index be5e090..45b3091 100644 --- a/atom.go +++ b/atom.go @@ -1,9 +1,8 @@ package feeder -import "os" import xmlx "github.com/jteeuwen/go-pkg-xmlx" -func (this *Feed) readAtom(doc *xmlx.Document) (err os.Error) { +func (this *Feed) readAtom(doc *xmlx.Document) (err error) { ns := "http://www.w3.org/2005/Atom" channels := doc.SelectNodes(ns, "feed") diff --git a/feed.go b/feed.go index a732114..30f6c5f 100644 --- a/feed.go +++ b/feed.go @@ -26,7 +26,7 @@ package feeder import ( - "os" + "errors" "time" xmlx "github.com/jteeuwen/go-pkg-xmlx" "fmt" @@ -84,7 +84,7 @@ func New(cachetimeout int, enforcecachelimit bool, ch ChannelHandler, ih ItemHan // The value is in seconds. func (this *Feed) LastUpdate() int64 { return this.lastupdate } -func (this *Feed) Fetch(uri string) (err os.Error) { +func (this *Feed) Fetch(uri string) (err error) { if !this.CanUpdate() { return } @@ -100,7 +100,7 @@ func (this *Feed) Fetch(uri string) (err os.Error) { this.Type, this.Version = this.GetVersionInfo(doc) if ok := this.testVersions(); !ok { - err = os.NewError(fmt.Sprintf("Unsupported feed: %s, version: %+v", this.Type, this.Version)) + err = errors.New(fmt.Sprintf("Unsupported feed: %s, version: %+v", this.Type, this.Version)) return } @@ -166,7 +166,7 @@ func (this *Feed) SecondsTillUpdate() int64 { return int64(this.CacheTimeout*60) - (utc.Seconds() - this.lastupdate) } -func (this *Feed) buildFeed(doc *xmlx.Document) (err os.Error) { +func (this *Feed) buildFeed(doc *xmlx.Document) (err error) { switch this.Type { case "rss": err = this.readRss2(doc) diff --git a/feed_test.go b/feed_test.go index 516fef6..008a3e1 100644 --- a/feed_test.go +++ b/feed_test.go @@ -1,10 +1,10 @@ package feeder import "testing" -import "os" func TestFeed(t *testing.T) { urilist := []string{ + //"http://localhost:8081/craigslist.rss", //"http://store.steampowered.com/feeds/news.xml", // This feed violates the rss spec. "http://cyber.law.harvard.edu/rss/examples/sampleRss091.xml", "http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml", @@ -13,7 +13,7 @@ func TestFeed(t *testing.T) { } var feed *Feed - var err os.Error + var err error for _, uri := range urilist { feed = New(5, true, chanHandler, itemHandler) diff --git a/rss.go b/rss.go index fd73b5d..c32ac61 100644 --- a/rss.go +++ b/rss.go @@ -1,11 +1,8 @@ package feeder -import ( - "os" - xmlx "github.com/jteeuwen/go-pkg-xmlx" -) +import xmlx "github.com/jteeuwen/go-pkg-xmlx" -func (this *Feed) readRss2(doc *xmlx.Document) (err os.Error) { +func (this *Feed) readRss2(doc *xmlx.Document) (err error) { days := make(map[string]int) days["Monday"] = 1 days["Tuesday"] = 2