diff --git a/write.go b/write.go index f57576c..fcf54b0 100644 --- a/write.go +++ b/write.go @@ -83,10 +83,7 @@ func setDefaultWriteOptions(opts *WriteOptions) { func enforcePolicyRules(in []roots.ValidatedEvent, boltdb *bolt.DB, batchSize int) (queued []roots.ValidatedEvent, excluded []ExcludedEvent) { for i := 0; i < len(in); i += batchSize { - end := i + batchSize - if end > len(in) { - end = len(in) - } + end := min(i+batchSize, len(in)) batch := in[i:end] eventIDs := make([]string, 0, len(batch))