title: detect last item inside an array using range inside go-templates
body: <p>This program outputs simply</p>
  
  <blockquote>
    <p>1,4,2,</p>
  </blockquote>
  
  <p>but I would like to print</p>
  
  <blockquote>
    <p>1,4,2.</p>
  </blockquote>
  
  <p>As you can see the comma is printed after each items of an array.</p>
  
  <pre><code>package main
  
  import "os"
  import "text/template"
  
  func main() {
      params := map[string]interface{}{
          "items": [3]int{1, 4, 2},
      }
      tpl := "{{range $i, $el := .items}}{{$el}},{{end}}"
      lister, _ := template.New("foo").Parse(tpl)
      lister.Execute(os.Stdout, params)
  }
  </code></pre>
  
  <p>Is there a way to change <code>{{range $i, $el := .items}}{{$el}},{{end}}</code> and be sure that last item will print "." instead of ","</p>