html.Engine will stop reading templates after first error
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 314
- Forks
- 61
- Avg merge
- 4h 35m
- Merged PRs (30d)
- 12
Description
Hi, today I had weird issue, I have registered templates, then seen 1 error in console about one of the templates, but application didn't fail, it worked but didn't load more templates.
1.html
2.html
3.html // Lets say this template is broken, 4 wont be loaded, but the app will behave like it's ok
4.html
How to reproduce?
htmlEngine := html.NewFileSystem(templates.GetFiles(), ".html")
app := fiber.New(fiber.Config{
Views: htmlEngine,
})
for _, v := range htmlEngine.Templates.Templates() {
println(v.Name())
}
now create package names templates and put some html files, then in one of these files put {{ ItDoesNotExists }}
then create .go file with code below:
package templates
//go:embed *.html
var content embed.FS
func GetFiles() http.FileSystem {
return http.FS(content)
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior through html.NewFileSystem with the embedded templates from templates.GetFiles(), including an invalid {{ ItDoesNotExists }} action. Inspect how htmlEngine.Templates.Templates() is populated after the first template error; done means later templates such as 4.html are still loaded and the error behavior is explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100