3 ms·
1) The first example in the blog post shows an inline template: t, err := template.New("todos").Parse("You have a task named \"{{ .Name}}\" with descriptio
by billhathaway 9y ago
1) The first example in the blog post shows an inline template:
t, err := template.New("todos").Parse("You have a task named \"{{ .Name}}\" with description: \"{{ .Description}}\"")
If you have a lot of templates and don't want to declare them in-line but also want to ship just an executable, you could use a project like https://github.com/GeertJohan/go.rice https://github.com/GeertJohan/go.rice which allows you to pack multiple files into a go executable and then reference them like files.
2) I'm not very familiar with the project but gogs https://github.com/gogits/gogs/tree/master/templates https://github.com/gogits/gogs/tree/master/templates has a lot
3) Hard to comment without seeing an approach
4) Agree
5) Generally templates should be parsed at start time, not re-parsed for every request. I'm not sure if I'm responding to what you are saying. Do you have link to some code you would like comments on?