func indexHandler(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {
	type Output struct {
		Message string
	}
	listFunction := func() (r []Output) {
		r = append(r, Output{Message: fmt.Sprint("one -")})
		r = append(r, Output{Message: fmt.Sprint("two-")})
		r = append(r, Output{Message: fmt.Sprint("three-")})
		r = append(r, Output{Message: fmt.Sprint("four-")})
		return
	}
	functionMap := template.FuncMap{
		"listFunction": listFunction,
	}
	t := template.Must(template.New("template.html").Funcs(functionMap).ParseFiles("template.html"))
	t = template.Must(t.New("body").Parse(itemTemplate))
	t.ExecuteTemplate(w, "template.html", "Index")
}
indexHandler uses append to populate slice
package main
import (
	"fmt"
	"github.com/julienschmidt/httprouter"
	"html/template"
	"net/http"
)
var itemTemplate = `
        {{ define "body" }}
           {{- range listFunction }}
			{{ .Message}}<br />
			{{- end}}
        {{ end }}
     	`
func main() {
	fmt.Println("HTTP port :80")
	r := httprouter.New()
	r.GET("/", indexHandler)
	r.GET("/view/", viewHandler)
	r.GET("/list/", listHandler)
	r.GET("/products/", postHandler)
	r.POST("/products/", postHandler)
	r.NotFound = http.FileServer(http.Dir("public"))
	http.ListenAndServe(":80", r)
}
func postHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
	type Output struct {
		Message string
	}
	selector := r.FormValue("from")
	selector2 := r.FormValue("to")
	method := r.Method
	options := []string{"BR01", "BR02", "BR03", "BR04", "BR05", "BR06"}
	if selector == "" {
		selector = options[0]
	}
	if selector2 == "" {
		selector2 = options[1]
	}
	listFunction := func() (r []Output) {
		r = append(r, Output{Message: "selector: " + selector})
		r = append(r, Output{Message: "selector2: " + selector2})
		r = append(r, Output{Message: "method: " + method})
		r = append(r, Output{Message: "three"})
		r = append(r, Output{Message: "four"})
		return
	}
	functionMap := template.FuncMap{
		"listFunction": listFunction,
	}
	itemTemplate := `{{ define "body" }}
<form name="form1" action="/products/" method="POST">
<p>From: ` +
		generateSelector("from", options, selector, selector2) +
		`To: ` +
		generateSelector("to", options, selector2, selector) +
		`</form>
</p>
   {{- range listFunction }}
	{{ .Message}}<br />
	{{- end}}
{{- end}}`
	t := template.Must(template.New("template.html").Funcs(functionMap).ParseFiles("template.html"))
	t = template.Must(t.New("body").Parse(itemTemplate))
	t.ExecuteTemplate(w, "template.html", "Post")
}
func viewHandler(w http.ResponseWriter, _ *http.Request, _ httprouter.Params) {
	type Output struct {
		Message string
	}
	listFunction := func() (r []Output) {
		r = append(r, Output{Message: fmt.Sprint("one")})
		r = append(r, Output{Message: fmt.Sprint("two")})
		r = append(r, Output{Message: fmt.Sprint("three")})
		r = append(r, Output{Message: fmt.Sprint("four")})
		return
	}
	functionMap := template.FuncMap{
		"listFunction": listFunction,
	}
	itemTemplate := `{{ define "body" }}
<p>
<a href="/aggregate/BR01/">01</a> |
<a href="/aggregate/BR02/">02</a> |
<a href="/aggregate/BR03/">03</a> |
<a href="/aggregate/BR04/">04</a> |
<a href="/aggregate/BR05/">05</a> |
<a href="/aggregate/BR06/">06</a> |
<form name="form1" action="/products/" method="POST">
<select name="t1" onchange="this.form.submit()">
<option value="ACCOUNTING">ACCOUNTING</option>
<option value="ACCOUNTING.AP">ACCOUNTING.AP</option>
<option value="OP.REG.MGR">OP.REG.MGR</option>
<option value="OPERATIONS.MGR">OPERATIONS.MGR</option>
<option value="PURCHASING">PURCHASING</option>
<option value="RECEIVING">RECEIVING</option>
<option value="RF.MANAGER">RF.MANAGER</option>
<option value="SALES.ACCOUNTING">SALES.ACCOUNTIN</option>
<option value="SUPER SALES">SUPER SALES</option>
<option value="TEST.OPR.M">TEST.OPR.M</option>
</select>
</form>
</p>
   {{- range listFunction }}
	{{ .Message}}<br />
	{{- end}} }}
{{- end}}`
	t := template.Must(template.New("template.html").Funcs(functionMap).ParseFiles("template.html"))
	t = template.Must(t.New("body").Parse(itemTemplate))
	t.ExecuteTemplate(w, "template.html", "View")
}