Directory auto-complete.

Right, makes sense as you are actually indexing the slice.

Another comment I had was to invert the conditions and do early returns to reduce indentation.

The two I have in mind are lastseparator == 0 { return []string{} } and !isDir { continue }

Then you can also move the i >= 10 check next to where i is incremented to avoid comparison on every loop