From 79b65d949ddf68d4e1d18191ea0db0faa9dff79b Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Sun, 22 Nov 2015 14:47:55 +0800 Subject: [PATCH 1/5] Try to fix time format problem Signed-off-by: ZhiFeng Hu --- rss.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rss.go b/rss.go index 62d9d7e..64ce52e 100644 --- a/rss.go +++ b/rss.go @@ -92,7 +92,7 @@ func newRssItem(i *Item) *RssItem { Link: i.Link.Href, Description: i.Description, Guid: i.Id, - PubDate: anyTimeFormat(time.RFC822, i.Created, i.Updated), + PubDate: anyTimeFormat("2006-01-02T15:04:05-07:00", i.Created, i.Updated), } intLength, err := strconv.ParseInt(i.Link.Length, 10, 64) @@ -108,8 +108,8 @@ func newRssItem(i *Item) *RssItem { // create a new RssFeed with a generic Feed struct's data func (r *Rss) RssFeed() *RssFeed { - pub := anyTimeFormat(time.RFC822, r.Created, r.Updated) - build := anyTimeFormat(time.RFC822, r.Updated) + pub := anyTimeFormat("2006-01-02T15:04:05-07:00", r.Created, r.Updated) + build := anyTimeFormat("2006-01-02T15:04:05-07:00", r.Updated) author := "" if r.Author != nil { author = r.Author.Email From f8b14841ebe486d64e15698fdab91cba3a442fb4 Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Sun, 22 Nov 2015 14:50:26 +0800 Subject: [PATCH 2/5] Remove unused time import Signed-off-by: ZhiFeng Hu --- rss.go | 1 - 1 file changed, 1 deletion(-) diff --git a/rss.go b/rss.go index 64ce52e..f715b60 100644 --- a/rss.go +++ b/rss.go @@ -8,7 +8,6 @@ import ( "encoding/xml" "fmt" "strconv" - "time" ) // private wrapper around the RssFeed which gives us the .. xml From 413fe3732e14525da723dfc25b241e7d580fbd06 Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Sun, 22 Nov 2015 15:07:34 +0800 Subject: [PATCH 3/5] Update time format RFC1123 Signed-off-by: ZhiFeng Hu --- rss.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rss.go b/rss.go index f715b60..fff69ed 100644 --- a/rss.go +++ b/rss.go @@ -8,6 +8,7 @@ import ( "encoding/xml" "fmt" "strconv" + "time" ) // private wrapper around the RssFeed which gives us the .. xml @@ -91,7 +92,7 @@ func newRssItem(i *Item) *RssItem { Link: i.Link.Href, Description: i.Description, Guid: i.Id, - PubDate: anyTimeFormat("2006-01-02T15:04:05-07:00", i.Created, i.Updated), + PubDate: anyTimeFormat(time.RFC1123, i.Created, i.Updated), } intLength, err := strconv.ParseInt(i.Link.Length, 10, 64) @@ -107,8 +108,8 @@ func newRssItem(i *Item) *RssItem { // create a new RssFeed with a generic Feed struct's data func (r *Rss) RssFeed() *RssFeed { - pub := anyTimeFormat("2006-01-02T15:04:05-07:00", r.Created, r.Updated) - build := anyTimeFormat("2006-01-02T15:04:05-07:00", r.Updated) + pub := anyTimeFormat(time.RFC1123, r.Created, r.Updated) + build := anyTimeFormat(time.RFC1123, r.Updated) author := "" if r.Author != nil { author = r.Author.Email From f3731b977a89f17be3e6efbecb2279f5ef0e0d26 Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Sun, 22 Nov 2015 15:14:22 +0800 Subject: [PATCH 4/5] Update rss pubDate Signed-off-by: ZhiFeng Hu --- rss.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rss.go b/rss.go index fff69ed..3381f74 100644 --- a/rss.go +++ b/rss.go @@ -92,7 +92,7 @@ func newRssItem(i *Item) *RssItem { Link: i.Link.Href, Description: i.Description, Guid: i.Id, - PubDate: anyTimeFormat(time.RFC1123, i.Created, i.Updated), + PubDate: anyTimeFormat(time.RFC1123Z, i.Created, i.Updated), } intLength, err := strconv.ParseInt(i.Link.Length, 10, 64) @@ -108,8 +108,8 @@ func newRssItem(i *Item) *RssItem { // create a new RssFeed with a generic Feed struct's data func (r *Rss) RssFeed() *RssFeed { - pub := anyTimeFormat(time.RFC1123, r.Created, r.Updated) - build := anyTimeFormat(time.RFC1123, r.Updated) + pub := anyTimeFormat(time.RFC1123Z, r.Created, r.Updated) + build := anyTimeFormat(time.RFC1123Z, r.Updated) author := "" if r.Author != nil { author = r.Author.Email From 0b6cae5672481517e885215d80728e6ffd9ebf15 Mon Sep 17 00:00:00 2001 From: ZhiFeng Hu Date: Sun, 22 Nov 2015 18:03:57 +0800 Subject: [PATCH 5/5] Fixed rss test Signed-off-by: ZhiFeng Hu --- feed_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/feed_test.go b/feed_test.go index f5f592d..ba2efdb 100644 --- a/feed_test.go +++ b/feed_test.go @@ -65,38 +65,38 @@ var rssOutput = ` discussion about tech, footie, photos This work is copyright © Benjamin Button jmoiron@jmoiron.net (Jason Moiron) - 16 Jan 13 21:52 EST + Wed, 16 Jan 2013 21:52:35 -0500 Limiting Concurrency in Go http://jmoiron.net/blog/limiting-concurrency-in-go/ A discussion on controlled parallelism in golang Jason Moiron - 16 Jan 13 21:52 EST + Wed, 16 Jan 2013 21:52:35 -0500 Logic-less Template Redux http://jmoiron.net/blog/logicless-template-redux/ More thoughts on logicless templates - 16 Jan 13 21:52 EST + Wed, 16 Jan 2013 21:52:35 -0500 Idiomatic Code Reuse in Go http://jmoiron.net/blog/idiomatic-code-reuse-in-go/ How to use interfaces <em>effectively</em> - 16 Jan 13 21:52 EST + Wed, 16 Jan 2013 21:52:35 -0500 Never Gonna Give You Up Mp3 http://example.com/RickRoll.mp3 Never gonna give you up - Never gonna let you down. - 16 Jan 13 21:52 EST + Wed, 16 Jan 2013 21:52:35 -0500 String formatting in Go http://example.com/strings How to use things like %s, %v, %d, etc. - 16 Jan 13 21:52 EST + Wed, 16 Jan 2013 21:52:35 -0500 `