代码拉取完成,页面将自动刷新
package input_files
import (
"fmt"
"strings"
)
func Templated() string {
name := T("cruel")
myName := T("evil")
fmt.Println(T("Hello {{.Name}} world!", map[string]interface{}{"Name": name}))
fmt.Println(T("Hello {{.Name}} world!, bye from {{.MyName}}", map[string]interface{}{"Name": name, "MyName": myName}))
fmt.Println(T("Hello {{.Name}} world!", map[string]interface{}{"Name": T("Evil")}))
//These should not have a map[string]interface{}
fmt.Println(T("Hello {{Not complex}} world! I am"), name)
fmt.Println(T("Hello {{}}"), myName)
fmt.Println(T("Hello {{.Name}} world!", map[string]interface{}{"Name": strings.ToUpper(name)}))
fmt.Println(T("Hello {{.Name}} world!", map[string]interface{}{"Name": strings.ToUpper(T("Hi"))}))
fmt.Println(T("Hello {{.Name}} world! {{.Number}} times", map[string]interface{}{"Name": name, "Number": 10}))
fmt.Println(T("Hello {{.Name}} world! {{.Float}} times", map[string]interface{}{"Name": name, "Float": 10.0}))
fmt.Println(T("Hello {{.Name}} world!", map[string]interface{}{"Name": strings.ToUpper(T("Hello {{.Name}} world!", map[string]interface{}{"Name": strings.ToUpper(name)}))}))
type something struct {
}
foo := something{}
strz := []string{T("one"), T("two"), T("buckle my shoe")}
fmt.Println(T("Welp, that's a great {{.MyStruct}} how about a {{.Whatever}}", map[string]interface{}{"MyStruct": &foo, "Whatever": strz[2]}))
println(T("Hello {{.Name}} world!", map[string]interface{}{"Name": name}))
println(T("Hello {{.Name}} world! {{.Name}}", map[string]interface{}{"Name": name}))
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。