V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
dkcook
V2EX  ›  Go 编程语言

golang 中有 text/template 标准包 , template 中的 Must 方法是怎么使用?

  •  
  •   dkcook · 2017-02-22 13:21:59 +08:00 · 577 次点击
    这是一个创建于 2620 天前的主题,其中的信息可能已经有所发展或是发生改变。

    第一种写法: t.templ = template.Must(template.ParseFiles(filepath.Join("templates", t.filename))) } 第二种写法: var t = template.Must(template.New("name").Parse("text"))

    山面两种有什么区别吗?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2722 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 05:11 · PVG 13:11 · LAX 22:11 · JFK 01:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.