Skip to content Skip to sidebar Skip to footer

Html Template Use On Golang

Sorry im beginner and i read golang.docs but didnt understand well. i`ve : index.html:
Copy

Solution 2:

The . is defined in go code.

Please provide the snippet of your go code where the template is executed, something like the following codes:

    t, _ := template.ParseFiles(tmpl + ".html")
    t.Execute(w, data) // the data must feature the field "checked"

Or

    templates.ExecuteTemplate(w, tmpl+".html", data) // the data must feature the field "checked"

You can pass any type(interface{}) to a functions that execute a template as "data". Usually it is a Struct or a Map[string]string.

How to set the checked Probably the "checked" is setted in the main.go at handler according to the posted form.

Read the docs and explain it better. Please

Post a Comment for "Html Template Use On Golang"