docs(discovery/crawler): clarify unused year param in parseDateAttr
This commit is contained in:
@@ -120,10 +120,13 @@ func parseFestivalAlarm(data []byte, sourceURL string, year int) ([]RawEvent, er
|
||||
return events, nil
|
||||
}
|
||||
|
||||
// parseDateAttr reads the content="YYYY-MM-DD" attribute from a span and
|
||||
// returns a *time.Time in UTC. Falls back to year for the year component if
|
||||
// the attribute is absent or malformed (shouldn't happen in practice).
|
||||
// parseDateAttr reads the content="YYYY-MM-DD" attribute from an itemprop
|
||||
// span and returns a *time.Time in UTC. Returns nil if absent or malformed.
|
||||
// The year parameter is accepted for signature symmetry with future sources
|
||||
// that may not include full dates in their markup; it is intentionally unused
|
||||
// here because festival-alarm always emits complete ISO dates.
|
||||
func parseDateAttr(s *goquery.Selection, year int) *time.Time {
|
||||
_ = year
|
||||
content, exists := s.Attr("content")
|
||||
if !exists || content == "" {
|
||||
return nil
|
||||
@@ -132,7 +135,5 @@ func parseDateAttr(s *goquery.Selection, year int) *time.Time {
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
// The site always includes the correct year in the attribute; just validate.
|
||||
_ = year
|
||||
return &t
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user