Go Template 自定义函数
Go html template 自定义函数 func GeoListGet(w http.ResponseWriter, r *http.Request) { tpl := template.New("main_parent.html") selfunc := make(template.FuncMap) selfunc["calNumber"] = CalNumbers tpl = tpl.Funcs(selfunc) var err error tpl, err = tpl.ParseFiles(fmt.Sprintf("%vparent/main_parent.html", conf.TmpPath), fmt.Sprintf("%vgeo/index.html", conf. …