Gerrit Bot has uploaded this change for review.
fix(template(main.go)): template.ParseFiles use precise path
only use filename will cause panic: open index.tmpl: no such file or directory
Change-Id: Ibb322c3fd85fde3d586f700cb4d6ec4acf5106f9
GitHub-Last-Rev: 4002060aa2917bc76789ee7f9b42270b01453514
GitHub-Pull-Request: golang/example#18
---
M template/main.go
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/template/main.go b/template/main.go
index 5da5475..08c3ef3 100644
--- a/template/main.go
+++ b/template/main.go
@@ -38,7 +38,7 @@
// indexTemplate is the main site template.
// The default template includes two template blocks ("sidebar" and "content")
// that may be replaced in templates derived from this one.
-var indexTemplate = template.Must(template.ParseFiles("index.tmpl"))
+var indexTemplate = template.Must(template.ParseFiles("template/index.tmpl"))
// Index is a data structure used to populate an indexTemplate.
type Index struct {
@@ -70,7 +70,7 @@
// imageTemplate is a clone of indexTemplate that provides
// alternate "sidebar" and "content" templates.
-var imageTemplate = template.Must(template.Must(indexTemplate.Clone()).ParseFiles("image.tmpl"))
+var imageTemplate = template.Must(template.Must(indexTemplate.Clone()).ParseFiles("template/image.tmpl"))
// Image is a data structure used to populate an imageTemplate.
type Image struct {
To view, visit change 303889. To unsubscribe, or for help writing mail filters, visit settings.
Gopher Robot abandoned this change.
To view, visit change 303889. To unsubscribe, or for help writing mail filters, visit settings.