Skip to content

第三章 tmpl.Parse 导致空白页的问题 #1

@noopoo

Description

@noopoo

我在运行第三章demo时,总是空白页面,调试时候发现把这一行

_, err = tmpl.Parse(string(content))

改成 tmpl.ParseFiles("/path/to/index.html") 之后就能正常显示页面,我读了下 Parse 和 ParseFiles函数源码,按照 ParseFiles 的写法把这一行改成下面这样,也可以正常显示

_, err = tmpl.New(fi.Name()).Parse(string(content))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions