Go Template

go 语言 Template 总结

go 语言中的 template 使用{{ }}来作为一个标识符,可以在其中插入相应的 template 支持的代码块。template 是一个模板,他所以来的数据从外部传进来。

形如:

tpl.Execute(buf, jObj.MustMap(make(map[string]interface{})))

tpl 就是我们的一个模板类,其中已经读取了我们存在本地的文件,Execute 方法传入了数据。