Makes days map a global lookup table

This commit is contained in:
Harm Aarts 2013-12-05 13:53:57 +01:00
parent 79d418e00a
commit 4fa6c97010
1 changed files with 10 additions and 8 deletions

18
rss.go
View File

@ -6,15 +6,17 @@ import (
xmlx "github.com/jteeuwen/go-pkg-xmlx" xmlx "github.com/jteeuwen/go-pkg-xmlx"
) )
var days = map[string]int{
"Monday": 1,
"Tuesday": 2,
"Wednesday": 3,
"Thursday": 4,
"Friday": 5,
"Saturday": 6,
"Sunday": 7,
}
func (this *Feed) readRss2(doc *xmlx.Document) (err error) { func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
days := make(map[string]int)
days["Monday"] = 1
days["Tuesday"] = 2
days["Wednesday"] = 3
days["Thursday"] = 4
days["Friday"] = 5
days["Saturday"] = 6
days["Sunday"] = 7
getChan := func(pubdate, title string) *Channel { getChan := func(pubdate, title string) *Channel {
for _, c := range this.Channels { for _, c := range this.Channels {