Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-04-03 22:16:36 +0300
committerbep <bjorn.erik.pedersen@gmail.com>2015-04-03 22:16:32 +0300
commitbea5feb34d5944e6dfc87dd292a85d100573397a (patch)
tree0b6172403463cf93a31ee088cbf57947f69a55f3 /helpers
parent99a18b21fcc2523015c071b8915cae00a83842b5 (diff)
Return early from DistinctErrorLogger's Printf
Diffstat (limited to 'helpers')
-rw-r--r--helpers/general.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/helpers/general.go b/helpers/general.go
index cf87c04b1..48e7dbd01 100644
--- a/helpers/general.go
+++ b/helpers/general.go
@@ -162,11 +162,12 @@ type DistinctErrorLogger struct {
func (l *DistinctErrorLogger) Printf(format string, v ...interface{}) {
logStatement := fmt.Sprintf(format, v...)
l.RLock()
- logged := l.m[logStatement]
- l.RUnlock()
- if logged {
+ if l.m[logStatement] {
+ l.RUnlock()
return
}
+ l.RUnlock()
+
l.Lock()
if !l.m[logStatement] {
jww.ERROR.Print(logStatement)