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
|
||||
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user