parseBatchStrategy normalizes a user-supplied strategy string. Unknown or empty values fall back to BatchNone (safe v1 behavior).
(s string)
| 23 | // parseBatchStrategy normalizes a user-supplied strategy string. Unknown |
| 24 | // or empty values fall back to BatchNone (safe v1 behavior). |
| 25 | func parseBatchStrategy(s string) BatchStrategy { |
| 26 | switch BatchStrategy(strings.ToLower(strings.TrimSpace(s))) { |
| 27 | case BatchByLanguage: |
| 28 | return BatchByLanguage |
| 29 | case BatchByDirectory: |
| 30 | return BatchByDirectory |
| 31 | default: |
| 32 | return BatchNone |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // groupBatches partitions items according to strategy, then slices each |
| 37 | // natural group into BatchSize-sized chunks (when size > 0). Within a batch |