validateWeeklySpec ensures that the day-of-month and month options of spec are both set to *
(spec string)
| 276 | // validateWeeklySpec ensures that the day-of-month and month options of |
| 277 | // spec are both set to * |
| 278 | func validateWeeklySpec(spec string) error { |
| 279 | parts := strings.Fields(spec) |
| 280 | if len(parts) < 5 { |
| 281 | return xerrors.Errorf("expected schedule to consist of 5 fields with an optional CRON_TZ=<timezone> prefix") |
| 282 | } |
| 283 | if len(parts) == 6 { |
| 284 | parts = parts[1:] |
| 285 | } |
| 286 | if parts[2] != "*" || parts[3] != "*" { |
| 287 | return xerrors.Errorf("expected day-of-month and month to be *") |
| 288 | } |
| 289 | return nil |
| 290 | } |
| 291 | |
| 292 | // validateDailySpec ensures that the day-of-month, month and day-of-week |
| 293 | // options of spec are all set to * |