Delete unnecessary nil checks from entry

This commit is contained in:
Jason Streifling 2024-10-15 18:35:53 +02:00
parent 1ecda50f34
commit f6bbc2fa6f

View File

@ -70,13 +70,11 @@ func (e *Entry) Check() error {
return fmt.Errorf("entry %v: %v", e.ID.URI, err)
}
if e.Categories != nil {
for i, c := range e.Categories {
if err := c.Check(); err != nil {
return fmt.Errorf("category element %v of entry %v: %v", i, e.ID.URI, err)
}
}
}
if e.Content != nil {
if err := (*e.Content).Check(); err != nil {
@ -88,21 +86,17 @@ func (e *Entry) Check() error {
}
}
if e.Contributors != nil {
for i, c := range e.Contributors {
if err := c.Check(); err != nil {
return fmt.Errorf("contributor element %v of entry %v: %v", i, e.ID.URI, err)
}
}
}
if e.Links != nil {
for i, l := range e.Links {
if err := l.Check(); err != nil {
return fmt.Errorf("link element %v of entry %v: %v", i, e.ID.URI, err)
}
}
}
if e.Published != nil {
if err := e.Published.Check(); err != nil {
@ -144,13 +138,11 @@ func (e *Entry) Check() error {
}
}
if e.Extensions != nil {
for i, x := range e.Extensions {
if err := x.Check(); err != nil {
return fmt.Errorf("extension element %v of entry %v: %v", i, e.ID.URI, err)
}
}
}
return nil
}