From 0ca61f0d5154c1e10bed13701b9f3f8ecc1e5cd3 Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Thu, 19 Sep 2024 20:34:59 +0200 Subject: [PATCH] fix(go): prevent double mutex unlock on `t.Fatal` Signed-off-by: Roman Volosatovs --- west.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.go b/west.go index 4923a94..5db70b5 100644 --- a/west.go +++ b/west.go @@ -98,7 +98,6 @@ func WithInstance(i *Instance, f func()) { func withCurrentInstance[T any](f func(*Instance) T, handleErr func(error)) T { instanceMu.RLock() - defer instanceMu.RUnlock() if instance == nil { instanceMu.RUnlock() func() { @@ -115,6 +114,7 @@ func withCurrentInstance[T any](f func(*Instance) T, handleErr func(error)) T { }() instanceMu.RLock() } + defer instanceMu.RUnlock() return f(instance) }