How have you Chunked a slice into slices of a set size, heres my way

Given a slice / array I needed to loop over it and create arrays of equal sizes or to chunk the array. This is what I came up with. I haven’t seen examples with golang templates, what would you do to chunk a slice into individual slices of a set size?

    {{ $testArrayToChunk := (slice "1" "2" "3" "4" "5" "6")}}

    {{ $.Scratch.Add "testing" (slice) }}
    {{ $.Scratch.Add "temp" (slice) }}

    {{ range $k, $v := $testArrayToChunk }}

        {{ $ck := (add $k 1) }}

        {{ $newArray := mod $ck 2 }}

        {{ if eq $newArray 0}}
            {{ $.Scratch.Add "temp" (slice $v) }}
            {{ $.Scratch.Add "testing" (slice ($.Scratch.Get "temp")) }}
            {{ $.Scratch.Set "temp" (slice)}}
        {{ else }}
            {{ $.Scratch.Add "temp" (slice $v) }}
        {{ end }}

    {{ end }}

Am curious, what is the use case for this?

To create a few rows of HTML with equal number of items in each row. I could just loop one long list and use the mod function to do the same but I wanted to try creating 4 slices within another slice