Avoid race condition in isInnerShortcode

As reported by Go's race detector.

See #917
This commit is contained in:
bep 2015-02-20 17:41:37 +01:00
parent a3892685bc
commit c33a8528f8

View file

@ -160,11 +160,10 @@ func isInnerShortcode(t *template.Template) bool {
return m
}
match, _ := regexp.MatchString("{{.*?\\.Inner.*?}}", t.Tree.Root.String())
isInnerShortcodeCache.Lock()
defer isInnerShortcodeCache.Unlock()
match, _ := regexp.MatchString("{{.*?\\.Inner.*?}}", t.Tree.Root.String())
isInnerShortcodeCache.m[t.Name()] = match
isInnerShortcodeCache.Unlock()
return match
}