mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Avoid race condition in isInnerShortcode
As reported by Go's race detector. See #917
This commit is contained in:
parent
a3892685bc
commit
c33a8528f8
1 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue