You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
381 B

package main
import (
"os"
"text/template"
)
type Todo struct {
Name string
Url string
}
func main() {
td := Todo{"Test templates", "Let's test a template to see the magic."}
t, err := template.New("todos").Parse("A radio named \"{{ .Name}}\" with url: \"{{ .Url}}\"")
if err != nil {
panic(err)
}
err = t.Execute(os.Stdout, td)
if err != nil {
panic(err)
}
}