How do I sort a map by default order?

I’ve been there before. Go orders keys by alphanum and there’s no way around it.

If you you know your keys you can do the following:

{{ range $book := .books }}
  <tr>
  {{ range slice "title" "price" "other" }}
    {{ with index $book . }}
      <td>{{ . }}</td>
    {{ end }}
  {{ end }}
  </tr>
{{ end }}
1 Like