mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-18 14:54:53 -04:00
Avoid race condition in isInnerShortcode
As reported by Go's race detector. See #917
This commit is contained in:
parent
a3892685bc
commit
c33a8528f8
@ -160,11 +160,10 @@ func isInnerShortcode(t *template.Template) bool {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
match, _ := regexp.MatchString("{{.*?\\.Inner.*?}}", t.Tree.Root.String())
|
|
||||||
|
|
||||||
isInnerShortcodeCache.Lock()
|
isInnerShortcodeCache.Lock()
|
||||||
|
defer isInnerShortcodeCache.Unlock()
|
||||||
|
match, _ := regexp.MatchString("{{.*?\\.Inner.*?}}", t.Tree.Root.String())
|
||||||
isInnerShortcodeCache.m[t.Name()] = match
|
isInnerShortcodeCache.m[t.Name()] = match
|
||||||
isInnerShortcodeCache.Unlock()
|
|
||||||
|
|
||||||
return match
|
return match
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user