I am trying to get some subtleties in the text / html template package. I read his documentation from golang website. It is hard to understand what exactly means. (dot) as a whole and at a certain time in the range. What exactly means "pipeline", maybe it's hard to understand, because my English is not my native language):
{{pipeline}}
The default textual representation of the value of the pipeline
is copied to the output.
Consider an example:
data := map[string]interface{}{
"struct": &Order{
ID: 1,
CustID: 2,
Total: 3.65,
Name: "Something",
},
"name1": "Timur",
"name2": "Renat",
}
t.ExecuteTemplate(rw, "index", data)
Here is the "index":
{{define "index"}}
{{range $x := .}}
{{.}}
<b>{{$x}}</b><br>
<i>{{$.struct.ID}}</i><br>
<br>
{{end}}
{{end}}
Conclusion:
Timur
Timur
1
Renat
Renat
1
{1 2 3.65 Something}
{1 2 3.65 Something}
1
source
share