How to index a slice element

go-templatesslice

I have a slice: Keys []* datastore.Key

How could I index one of them in the template file? I guessed {{.Keys[3] }}, but that doesn't work and I searched a lot but with no clue.

Any suggestions would be welcome, thanks.

Best Answer

Use the index command like so:

{{index .Keys 3}}