File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ func New(directory, extension string) *Engine {
4343 extension : extension ,
4444 layout : "embed" ,
4545 funcmap : make (map [string ]interface {}),
46- Templates : make (map [string ]* template.Template ),
4746 }
4847 engine .AddFunc (engine .layout , func () error {
4948 return fmt .Errorf ("layout called unexpectedly." )
@@ -58,7 +57,6 @@ func NewFileSystem(fs http.FileSystem, extension string) *Engine {
5857 extension : extension ,
5958 layout : "embed" ,
6059 funcmap : make (map [string ]interface {}),
61- Templates : make (map [string ]* template.Template ),
6260 }
6361 engine .AddFunc (engine .layout , func () error {
6462 return fmt .Errorf ("layout called unexpectedly." )
@@ -115,6 +113,8 @@ func (e *Engine) Load() error {
115113 e .mutex .Lock ()
116114 defer e .mutex .Unlock ()
117115
116+ e .Templates = make (map [string ]* template.Template )
117+
118118 // Set template settings
119119 // prepare the global amber funcs
120120 funcs := template.FuncMap {}
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ func New(directory, extension string) *Engine {
4040 directory : directory ,
4141 extension : extension ,
4242 layout : "embed" ,
43- Templates : make (map [string ]* mustache.Template ),
4443 }
4544 return engine
4645}
@@ -51,7 +50,6 @@ func NewFileSystem(fs http.FileSystem, extension string) *Engine {
5150 fileSystem : fs ,
5251 extension : extension ,
5352 layout : "embed" ,
54- Templates : make (map [string ]* mustache.Template ),
5553 }
5654 return engine
5755}
@@ -95,6 +93,9 @@ func (e *Engine) Load() error {
9593 // race safe
9694 e .mutex .Lock ()
9795 defer e .mutex .Unlock ()
96+
97+ e .Templates = make (map [string ]* mustache.Template )
98+
9899 // Loop trough each directory and register template files
99100 walkFn := func (path string , info os.FileInfo , err error ) error {
100101 // Return error if exist
Original file line number Diff line number Diff line change @@ -66,7 +66,6 @@ func NewFileSystem(fs http.FileSystem, extension string) *Engine {
6666 extension : extension ,
6767 layout : "embed" ,
6868 funcmap : make (map [string ]interface {}),
69- Templates : template .New ("/" ),
7069 }
7170 engine .AddFunc (engine .layout , func () error {
7271 return fmt .Errorf ("layout called unexpectedly." )
You can’t perform that action at this time.
0 commit comments