Add mutex for protect Context.Keys map (#1391)

* Add mutex for protect Context.Keys map

* Fix tests

Co-authored-by: Nikolay Tolkachov <nik.tolkachov@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
AcoNCodes
2020-03-16 18:52:02 +02:00
committed by GitHub
parent 67008be35f
commit 73ccfea3ba
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ func Default() *Engine {
}
func (engine *Engine) allocateContext() *Context {
return &Context{engine: engine}
return &Context{engine: engine, KeysMutex: &sync.RWMutex{}}
}
// Delims sets template left and right delims and returns a Engine instance.