go-mega-code icon indicating copy to clipboard operation
go-mega-code copied to clipboard

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

Open noopoo opened this issue 4 years ago • 0 comments

我在运行第三章demo时,总是空白页面,调试时候发现把这一行 https://github.com/bonfy/go-mega-code/blob/e5fd3ef25bcc6874818621d06e68dee3d379778a/main.go#L54 改成 tmpl.ParseFiles("/path/to/index.html") 之后就能正常显示页面,我读了下 Parse 和 ParseFiles函数源码,按照 ParseFiles 的写法把这一行改成下面这样,也可以正常显示

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

noopoo avatar Aug 04 '19 09:08 noopoo