mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 22:53:43 +08:00
14 lines
252 B
Go
14 lines
252 B
Go
// predefined_functions.go
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"text/template"
|
|
)
|
|
|
|
func main() {
|
|
t := template.New("test")
|
|
t = template.Must(t.Parse("{{with $x := `hello`}}{{printf `%s %s` $x `Mary`}}{{end}}!\n"))
|
|
t.Execute(os.Stdout, nil)
|
|
}
|
|
// hello Mary! |