Skip to content

Commit bd2bf65

Browse files
authored
Merge pull request #66 from Icinga/BatchSliceOfStrings-0
BatchSliceOfStrings(): panic if count <= 0
2 parents 15703e6 + 080e15a commit bd2bf65

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

utils/utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ func Timed(start time.Time, callback func(elapsed time.Duration)) {
3030
}
3131

3232
// BatchSliceOfStrings groups the given keys into chunks of size count and streams them into a returned channel.
33+
// Panics if count is less than or equal to zero.
3334
func BatchSliceOfStrings(ctx context.Context, keys []string, count int) <-chan []string {
35+
if count <= 0 {
36+
panic("chunk size must be greater than zero")
37+
}
38+
3439
batches := make(chan []string)
3540

3641
go func() {

0 commit comments

Comments
 (0)