From c8551159fe32669ea2310a938933458ad013c21f Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Tue, 5 Mar 2024 17:05:44 +0100 Subject: [PATCH] Added NewFeed() --- rss.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rss.go b/rss.go index c9b991a..79fac04 100644 --- a/rss.go +++ b/rss.go @@ -185,11 +185,6 @@ func (c *Channel) check() error { } func (f *Feed) check() error { - f = &Feed{ - Version: "2.0", - ContentNamespace: "http://purl.org/rss/1.0/modules/content/", - } - if f.Channels == nil { return fmt.Errorf("error: feed has no channels") } @@ -203,6 +198,13 @@ func (f *Feed) check() error { return nil } +func NewFeed() *Feed { + return &Feed{ + Version: "2.0", + ContentNamespace: "http://purl.org/rss/1.0/modules/content/", + } +} + func (f *Feed) ToXML() (string, error) { if err := f.check(); err != nil { return "", fmt.Errorf("error checking RSS feed: %v", err)