How can I write a more elegant index traversal algorithm?

In the text, using a suffix array, I selected the indices, at the moment my traversal algorithm looks like this, I am sure that there are more elegant versions using classical algorithms.

index := suffixarray.New(buff.Bytes())
offset := index.Lookup(searchIndex, -1)
sort.Ints(offset)
l := len(offset)
sliceOfBytes := make([][]byte, l)
for iter := 0; l > 0; iter++ {
    if l == 1 {
        sliceOfBytes[iter] = buff.Next(offset[len(offset)-1])
        break
    }
    sliceOfBytes[iter] = buff.Next(offset[iter+1] - offset[iter])
    l--
}

What’s the desired result of sliceOfBytes after this? I’m not really familiar with suffix arrays, but it looks to me like you’re getting all of the text between the first and last occurrences of your searchIndex. Is that right?