Correct compile fail, use .Lookup correctly.

This commit is contained in:
Guy M. Allard
2017-07-02 12:42:45 -04:00
parent 483889c6da
commit fe85a5c992
2 changed files with 6 additions and 6 deletions

View File

@@ -365,13 +365,13 @@ func main() {
templates, err = template.ParseFiles(allFiles...) #parses all .tmpl files in the 'templates' folder
s1, _ := templates.LookUp("header.tmpl")
s1 := templates.Lookup("header.tmpl")
s1.ExecuteTemplate(os.Stdout, "header", nil)
fmt.Println()
s2, _ := templates.LookUp("content.tmpl")
s2 := templates.Lookup("content.tmpl")
s2.ExecuteTemplate(os.Stdout, "content", nil)
fmt.Println()
s3, _ := templates.LookUp("footer.tmpl")
s3 := templates.Lookup("footer.tmpl")
s3.ExecuteTemplate(os.Stdout, "footer", nil)
fmt.Println()
s3.Execute(os.Stdout, nil)

View File

@@ -364,13 +364,13 @@ Código:
templates, err = template.ParseFiles(allFiles...) #parses all .tmpl files in the 'templates' folder
s1, _ := templates.LookUp("header.tmpl")
s1 := templates.Lookup("header.tmpl")
s1.ExecuteTemplate(os.Stdout, "header", nil)
fmt.Println()
s2, _ := templates.LookUp("content.tmpl")
s2 := templates.Lookup("content.tmpl")
s2.ExecuteTemplate(os.Stdout, "content", nil)
fmt.Println()
s3, _ := templates.LookUp("footer.tmpl")
s3 := templates.Lookup("footer.tmpl")
s3.ExecuteTemplate(os.Stdout, "footer", nil)
fmt.Println()
s3.Execute(os.Stdout, nil)