shithub: hugo

Download patch

ref: bea5feb34d5944e6dfc87dd292a85d100573397a
parent: 99a18b21fcc2523015c071b8915cae00a83842b5
author: bep <[email protected]>
date: Fri Apr 3 17:16:36 EDT 2015

Return early from DistinctErrorLogger's Printf

--- a/helpers/general.go
+++ b/helpers/general.go
@@ -162,11 +162,12 @@
 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)