I have a template in go using the http/template
package. How do I iterate over both the keys and values in the template?
Example code :
template := `
<html>
<body>
<h1>Test Match</h1>
<ul>
{{range .}}
<li> {{.}} </li>
{{end}}
</ul>
</body>
</html>`
dataMap["SOMETHING"] = 124
dataMap["Something else"] = 125
t, _ := template.Parse(template)
t.Execute(w,dataMap)
How do I access the key in {{range}}
in the template