From 2581d3ee7e6338fc6d8d264da306a15dca76335b Mon Sep 17 00:00:00 2001 From: arriven <20084245+Arriven@users.noreply.github.com> Date: Sun, 31 Jul 2022 16:42:06 +0300 Subject: [PATCH] make linter happy --- src/utils/locker.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/locker.go b/src/utils/locker.go index 8bbb8fb8..232caa65 100644 --- a/src/utils/locker.go +++ b/src/utils/locker.go @@ -8,8 +8,12 @@ type Locker struct { func (m *Locker) Lock(key string) func() { value, _ := m.mutexes.LoadOrStore(key, &sync.Mutex{}) - mtx := value.(*sync.Mutex) - mtx.Lock() + mtx, ok := value.(*sync.Mutex) + if ok { + mtx.Lock() - return func() { mtx.Unlock() } + return func() { mtx.Unlock() } + } + + return func() {} }