From 737be2b9af4a07bf4a77e7ac2fad029b74ab8f01 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 5fc727d02e4d..892cfcc3e1ac 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) }) }