Correct compile fail, use .Lookup correctly.
This commit is contained in:
@@ -365,13 +365,13 @@ func main() {
|
|||||||
|
|
||||||
templates, err = template.ParseFiles(allFiles...) #parses all .tmpl files in the 'templates' folder
|
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)
|
s1.ExecuteTemplate(os.Stdout, "header", nil)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
s2, _ := templates.LookUp("content.tmpl")
|
s2 := templates.Lookup("content.tmpl")
|
||||||
s2.ExecuteTemplate(os.Stdout, "content", nil)
|
s2.ExecuteTemplate(os.Stdout, "content", nil)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
s3, _ := templates.LookUp("footer.tmpl")
|
s3 := templates.Lookup("footer.tmpl")
|
||||||
s3.ExecuteTemplate(os.Stdout, "footer", nil)
|
s3.ExecuteTemplate(os.Stdout, "footer", nil)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
s3.Execute(os.Stdout, nil)
|
s3.Execute(os.Stdout, nil)
|
||||||
|
|||||||
@@ -364,13 +364,13 @@ Código:
|
|||||||
|
|
||||||
templates, err = template.ParseFiles(allFiles...) #parses all .tmpl files in the 'templates' folder
|
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)
|
s1.ExecuteTemplate(os.Stdout, "header", nil)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
s2, _ := templates.LookUp("content.tmpl")
|
s2 := templates.Lookup("content.tmpl")
|
||||||
s2.ExecuteTemplate(os.Stdout, "content", nil)
|
s2.ExecuteTemplate(os.Stdout, "content", nil)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
s3, _ := templates.LookUp("footer.tmpl")
|
s3 := templates.Lookup("footer.tmpl")
|
||||||
s3.ExecuteTemplate(os.Stdout, "footer", nil)
|
s3.ExecuteTemplate(os.Stdout, "footer", nil)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
s3.Execute(os.Stdout, nil)
|
s3.Execute(os.Stdout, nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user