gofix error

This commit is contained in:
jim teeuwen 2011-11-02 16:51:04 +01:00
parent 59e30a75dc
commit e31aff8084
4 changed files with 9 additions and 13 deletions

View File

@ -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")

View File

@ -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)

View File

@ -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)

7
rss.go
View File

@ -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