From ae24db0c08c58bc2b38fc5c473b185f4d57578c5 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Sun, 20 Oct 2024 14:31:54 +0200 Subject: [PATCH] Clarified Add method's comments --- commonAttributes.go | 3 ++- entry.go | 14 ++++++++------ feed.go | 15 ++++++++------- person.go | 3 ++- source.go | 14 ++++++++------ 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/commonAttributes.go b/commonAttributes.go index 948f3f0..8c8dc6d 100644 --- a/commonAttributes.go +++ b/commonAttributes.go @@ -17,7 +17,8 @@ func newCommonAttributes() *CommonAttributes { return new(CommonAttributes) } -// AddAttribute adds the attribute to the CommonAttributes. It returns an int. +// AddAttribute adds the attribute to the CommonAttributes. It returns its index +// as an int. func (c *CommonAttributes) AddAttribute(name, value string) int { return addToSlice(&c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value}) } diff --git a/entry.go b/entry.go index 0a4c6e3..9b941d2 100644 --- a/entry.go +++ b/entry.go @@ -66,7 +66,8 @@ func NewEntry(title string) *Entry { } } -// AddAuthor adds the Person as an author to the Entry. It returns an int. +// AddAuthor adds the Person as an author to the Entry. It returns its index as +// an int. func (e *Entry) AddAuthor(p *Person) int { e.Updated = NewDate(time.Now()) return addToSlice(&e.Authors, p) @@ -82,7 +83,7 @@ func (e *Entry) DeleteAuthor(index int) error { return nil } -// AddCategory adds the Category to the Entry. It returns an int. +// AddCategory adds the Category to the Entry. It returns ts index as an int. func (e *Entry) AddCategory(c *Category) int { e.Updated = NewDate(time.Now()) return addToSlice(&e.Categories, c) @@ -99,8 +100,8 @@ func (e *Entry) DeleteCategory(index int) error { return nil } -// AddContributor adds the Person as a contributor to the Entry. It returns an -// int. +// AddContributor adds the Person as a contributor to the Entry. It returns its +// index as an int. func (e *Entry) AddContributor(c *Person) int { e.Updated = NewDate(time.Now()) return addToSlice(&e.Contributors, c) @@ -117,7 +118,7 @@ func (e *Entry) DeleteContributor(index int) error { return nil } -// AddLink adds the Link to the Entry. It returns an int. +// AddLink adds the Link to the Entry. It returns its index as an int. func (e *Entry) AddLink(l *Link) int { e.Updated = NewDate(time.Now()) return addToSlice(&e.Links, l) @@ -133,7 +134,8 @@ func (e *Entry) DeleteLink(index int) error { return nil } -// AddExtension adds the ExtensionElement to the Entry. It returns an int. +// AddExtension adds the ExtensionElement to the Entry. It returns its index as +// an int. func (e *Entry) AddExtension(x *ExtensionElement) int { e.Updated = NewDate(time.Now()) return addToSlice(&e.Extensions, x) diff --git a/feed.go b/feed.go index b60377d..ec25d86 100644 --- a/feed.go +++ b/feed.go @@ -35,7 +35,8 @@ func NewFeed(title string) *Feed { } } -// AddAuthor adds the Person as an author to the Feed. It returns an int. +// AddAuthor adds the Person as an author to the Feed. It returns its index as +// an int. func (f *Feed) AddAuthor(p *Person) int { f.Updated = NewDate(time.Now()) return addToSlice(&f.Authors, p) @@ -51,7 +52,7 @@ func (f *Feed) DeleteAuthor(index int) error { return nil } -// AddCategory adds the Category to the Feed. It returns an int. +// AddCategory adds the Category to the Feed. It returns its index as an int. func (f *Feed) AddCategory(c *Category) int { f.Updated = NewDate(time.Now()) return addToSlice(&f.Categories, c) @@ -68,8 +69,8 @@ func (f *Feed) DeleteCategory(index int) error { return nil } -// AddContributor adds the Person as a contributor to the Feed. It returns an -// int. +// AddContributor adds the Person as a contributor to the Feed. It returns its +// index as an int. func (f *Feed) AddContributor(c *Person) int { f.Updated = NewDate(time.Now()) return addToSlice(&f.Contributors, c) @@ -87,7 +88,7 @@ func (f *Feed) DeleteContributor(index int) error { } // AddLink adds the Link to the Feed. There should be one Link with Rel "self". -// It returns an int. +// It returns its index as an int. func (f *Feed) AddLink(l *Link) int { f.Updated = NewDate(time.Now()) return addToSlice(&f.Links, l) @@ -103,7 +104,7 @@ func (f *Feed) DeleteLink(index int) error { return nil } -// AddExtension adds the Extension to the Feed. It returns an int. +// AddExtension adds the Extension to the Feed. It returns its index as an int. func (f *Feed) AddExtension(e *ExtensionElement) int { f.Updated = NewDate(time.Now()) return addToSlice(&f.Extensions, e) @@ -120,7 +121,7 @@ func (f *Feed) DeleteExtension(index int) error { return nil } -// AddEntry adds the Entry to the Feed. It returns an int. +// AddEntry adds the Entry to the Feed. It returns its index as an int. func (f *Feed) AddEntry(e *Entry) int { f.Updated = NewDate(time.Now()) return addToSlice(&f.Entries, e) diff --git a/person.go b/person.go index 85cf926..665ac31 100644 --- a/person.go +++ b/person.go @@ -21,7 +21,8 @@ func NewPerson(name string) *Person { } } -// AddExtension adds the Extension to the Person. It returns an int. +// AddExtension adds the Extension to the Person. It returns its index as an +// int. func (p *Person) AddExtension(e *ExtensionElement) int { return addToSlice(&p.Extensions, e) } diff --git a/source.go b/source.go index 1d15f84..33e791a 100644 --- a/source.go +++ b/source.go @@ -28,7 +28,8 @@ func NewSource() *Source { return &Source{CommonAttributes: newCommonAttributes()} } -// AddAuthor adds the Person as an author to the Source. It returns an int. +// AddAuthor adds the Person as an author to the Source. It returns its index as +// an int. func (s *Source) AddAuthor(p *Person) int { return addToSlice(&s.Authors, p) } @@ -41,7 +42,7 @@ func (s *Source) DeleteAuthor(index int) error { return nil } -// AddCategory adds the Category to the Source. It returns an int. +// AddCategory adds the Category to the Source. It returns its index as an int. func (s *Source) AddCategory(c *Category) int { return addToSlice(&s.Categories, c) } @@ -55,8 +56,8 @@ func (s *Source) DeleteCategory(index int) error { return nil } -// AddContributor adds the Person as a contributor to the Source. It returns an -// int. +// AddContributor adds the Person as a contributor to the Source. It returns its +// index as an int. func (s *Source) AddContributor(c *Person) int { return addToSlice(&s.Contributors, c) } @@ -70,7 +71,7 @@ func (s *Source) DeleteContributor(index int) error { return nil } -// AddLink adds the Link to the Source. It returns an int. +// AddLink adds the Link to the Source. It returns its index as an int. func (s *Source) AddLink(l *Link) int { return addToSlice(&s.Links, l) } @@ -83,7 +84,8 @@ func (s *Source) DeleteLink(index int) error { return nil } -// AddExtension adds the ExtensionElement to the Source. It returns an int. +// AddExtension adds the ExtensionElement to the Source. It returns its index as +// an int. func (s *Source) AddExtension(e *ExtensionElement) int { return addToSlice(&s.Extensions, e) }