267
268
// handle @hourly, etc.
270
>
271
>
// split fields
272
>
cal := schedulepb.CalendarSpec{Comment: comment}
273
>
// Use FieldsSeq to avoid building an unbounded slice; we only accept 5–7 fields.
274
>
const maxCronFields = 7
275
>
var toks [maxCronFields]string
276
>
n := 0
277
>
for tok := range strings.FieldsSeq(c) {
278
>
if n < maxCronFields {
279
>
toks[n] = tok
280
>
n++
281
>
continue
282
}
283
// More than 7 fields → invalid.
284
return nil, nil, "", errors.New("CronString does not have 5-7 fields")
285
}
287
case 5:
288
cal.Minute, cal.Hour, cal.DayOfMonth, cal.Month, cal.DayOfWeek = toks[0], toks[1], toks[2], toks[3], toks[4]