Created
May 13, 2019 17:44
-
-
Save dbridges/6fee63da2733e825efcffb93f45dfaa9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func loadTemplate() *template.Template { | |
templates, err := filepath.Glob("templates/*") | |
if err != nil { | |
log.Println(err) | |
} | |
t := template.Must(template.New("layout.go.html").ParseFiles(templates...)) | |
return t | |
} | |
func main() { | |
// ... | |
t := loadTemplate() | |
writer := &strings.Builder{} | |
err := t.Execute(writer, feeds) | |
if err != nil { | |
log.Fatalln(err) | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment