mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Avoid race condition in isInnerShortcode
As reported by Go's race detector. See #917
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user