ref: c33a8528f864b71f046e0325121a809580d85531
parent: a3892685bc33b7518894ea21ae2d8a7c9f29e735
author: bep <[email protected]>
date: Fri Feb 20 12:41:37 EST 2015
Avoid race condition in isInnerShortcode As reported by Go's race detector. See #917
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -160,11 +160,10 @@
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
}