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,11 +70,9 @@ func (e *Entry) Check() error {
return fmt.Errorf("entry %v: %v", e.ID.URI, err) return fmt.Errorf("entry %v: %v", e.ID.URI, err)
} }
if e.Categories != nil { for i, c := range e.Categories {
for i, c := range e.Categories { if err := c.Check(); err != nil {
if err := c.Check(); err != nil { return fmt.Errorf("category element %v of entry %v: %v", i, e.ID.URI, err)
return fmt.Errorf("category element %v of entry %v: %v", i, e.ID.URI, err)
}
} }
} }
@ -88,19 +86,15 @@ func (e *Entry) Check() error {
} }
} }
if e.Contributors != nil { for i, c := range e.Contributors {
for i, c := range e.Contributors { if err := c.Check(); err != nil {
if err := c.Check(); err != nil { return fmt.Errorf("contributor element %v of entry %v: %v", i, e.ID.URI, err)
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 {
for i, l := range e.Links { if err := l.Check(); err != nil {
if err := l.Check(); err != nil { return fmt.Errorf("link element %v of entry %v: %v", i, e.ID.URI, err)
return fmt.Errorf("link element %v of entry %v: %v", i, e.ID.URI, err)
}
} }
} }
@ -144,11 +138,9 @@ func (e *Entry) Check() error {
} }
} }
if e.Extensions != nil { for i, x := range e.Extensions {
for i, x := range e.Extensions { if err := x.Check(); err != nil {
if err := x.Check(); err != nil { return fmt.Errorf("extension element %v of entry %v: %v", i, e.ID.URI, err)
return fmt.Errorf("extension element %v of entry %v: %v", i, e.ID.URI, err)
}
} }
} }