title: Iterate over only the first n items of an array in a Go template
body: <p>I have a vector with <code>n</code> elements. I'm using it to render items in a template. But I need to render only the 5 first elements. Please note that is possible to have less than 5 elements in vector, in this case will render all elements. Is there is a way to do it in template?</p>
  
  <pre><code>{{range .Categorias}}
      &lt;li class="nav-item"&gt;
          {{.Nome}}
      &lt;/li&gt;
  {{end}}
  </code></pre>