validateTimeRangeSpec ensures that the minutes field is set to *
(spec string)
| 307 | |
| 308 | // validateTimeRangeSpec ensures that the minutes field is set to * |
| 309 | func validateTimeRangeSpec(spec string) error { |
| 310 | parts := strings.Fields(spec) |
| 311 | if len(parts) < 5 { |
| 312 | return xerrors.Errorf("expected schedule to consist of 5 fields with an optional CRON_TZ=<timezone> prefix") |
| 313 | } |
| 314 | if len(parts) == 6 { |
| 315 | parts = parts[1:] |
| 316 | } |
| 317 | if parts[0] != "*" { |
| 318 | return xerrors.Errorf("expected minutes to be *") |
| 319 | } |
| 320 | return nil |
| 321 | } |