Go Templates

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Syntax

  • t, err := template.Parse({{.MyName .MyAge}})

  • t.Execute(os.Stdout,struct{MyValue,MyAge string}{"John Doe","40.1"})

Remarks

Golang provides packages like:

  1. text/template

  2. html/template

to implement data-driven templates for generating textual and HTML outputs.



Got any Go Question?