Added NewFeed()
This commit is contained in:
parent
9d8cc64645
commit
c8551159fe
12
rss.go
12
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user