predefined_functions.go 252 B

1234567891011121314
  1. // predefined_functions.go
  2. package main
  3. import (
  4. "os"
  5. "text/template"
  6. )
  7. func main() {
  8. t := template.New("test")
  9. t = template.Must(t.Parse("{{with $x := `hello`}}{{printf `%s %s` $x `Mary`}}{{end}}!\n"))
  10. t.Execute(os.Stdout, nil)
  11. }
  12. // hello Mary!