From 6c3fea0fc9db561aafd9ec017980d0ac87516b87 Mon Sep 17 00:00:00 2001 From: aaronbuchwald Date: Fri, 8 Apr 2022 10:02:16 -0400 Subject: [PATCH] log: modify lock defer unlock order in sync handler (#24667) This modifies the order of Lock() defer Unlock() to follow the more typically used pattern. --- log/handler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/log/handler.go b/log/handler.go index 4ad433334e..4b9515fa15 100644 --- a/log/handler.go +++ b/log/handler.go @@ -52,8 +52,9 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler { func SyncHandler(h Handler) Handler { var mu sync.Mutex return FuncHandler(func(r *Record) error { - defer mu.Unlock() mu.Lock() + defer mu.Unlock() + return h.Log(r) }) }