gofix error
This commit is contained in:
parent
59e30a75dc
commit
e31aff8084
3
atom.go
3
atom.go
|
@ -1,9 +1,8 @@
|
||||||
package feeder
|
package feeder
|
||||||
|
|
||||||
import "os"
|
|
||||||
import xmlx "github.com/jteeuwen/go-pkg-xmlx"
|
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"
|
ns := "http://www.w3.org/2005/Atom"
|
||||||
channels := doc.SelectNodes(ns, "feed")
|
channels := doc.SelectNodes(ns, "feed")
|
||||||
|
|
||||||
|
|
8
feed.go
8
feed.go
|
@ -26,7 +26,7 @@
|
||||||
package feeder
|
package feeder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
xmlx "github.com/jteeuwen/go-pkg-xmlx"
|
xmlx "github.com/jteeuwen/go-pkg-xmlx"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -84,7 +84,7 @@ func New(cachetimeout int, enforcecachelimit bool, ch ChannelHandler, ih ItemHan
|
||||||
// The value is in seconds.
|
// The value is in seconds.
|
||||||
func (this *Feed) LastUpdate() int64 { return this.lastupdate }
|
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() {
|
if !this.CanUpdate() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func (this *Feed) Fetch(uri string) (err os.Error) {
|
||||||
this.Type, this.Version = this.GetVersionInfo(doc)
|
this.Type, this.Version = this.GetVersionInfo(doc)
|
||||||
|
|
||||||
if ok := this.testVersions(); !ok {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ func (this *Feed) SecondsTillUpdate() int64 {
|
||||||
return int64(this.CacheTimeout*60) - (utc.Seconds() - this.lastupdate)
|
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 {
|
switch this.Type {
|
||||||
case "rss":
|
case "rss":
|
||||||
err = this.readRss2(doc)
|
err = this.readRss2(doc)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package feeder
|
package feeder
|
||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
import "os"
|
|
||||||
|
|
||||||
func TestFeed(t *testing.T) {
|
func TestFeed(t *testing.T) {
|
||||||
urilist := []string{
|
urilist := []string{
|
||||||
|
//"http://localhost:8081/craigslist.rss",
|
||||||
//"http://store.steampowered.com/feeds/news.xml", // This feed violates the rss spec.
|
//"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/sampleRss091.xml",
|
||||||
"http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml",
|
"http://cyber.law.harvard.edu/rss/examples/sampleRss092.xml",
|
||||||
|
@ -13,7 +13,7 @@ func TestFeed(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var feed *Feed
|
var feed *Feed
|
||||||
var err os.Error
|
var err error
|
||||||
|
|
||||||
for _, uri := range urilist {
|
for _, uri := range urilist {
|
||||||
feed = New(5, true, chanHandler, itemHandler)
|
feed = New(5, true, chanHandler, itemHandler)
|
||||||
|
|
7
rss.go
7
rss.go
|
@ -1,11 +1,8 @@
|
||||||
package feeder
|
package feeder
|
||||||
|
|
||||||
import (
|
import xmlx "github.com/jteeuwen/go-pkg-xmlx"
|
||||||
"os"
|
|
||||||
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 := make(map[string]int)
|
||||||
days["Monday"] = 1
|
days["Monday"] = 1
|
||||||
days["Tuesday"] = 2
|
days["Tuesday"] = 2
|
||||||
|
|
Loading…
Reference in New Issue