Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix go-for-loop reference bug in template caching.

Kailash Nadh281c47198cf3
diff --git a/cmd/init.go b/cmd/init.go
index d00f026a..4b0caf43 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -439,11 +439,12 @@ func initTxTemplates(m *manager.Manager, app *App) {
}
for _, t := range tpls {
- if err := t.Compile(app.manager.GenericTemplateFuncs()); err != nil {
- lo.Printf("error compiling transactional template %d: %v", t.ID, err)
+ tpl := t
+ if err := tpl.Compile(app.manager.GenericTemplateFuncs()); err != nil {
+ lo.Printf("error compiling transactional template %d: %v", tpl.ID, err)
continue
}
- m.CacheTpl(t.ID, &t)
+ m.CacheTpl(tpl.ID, &tpl)
}
}