deadlog
A Go library for debugging mutex deadlocks with logged wrappers and analysis tools.
Installation
go get github.com/stevenctl/deadlog
Usage
Replace sync.Mutex or sync.RWMutex with deadlog.Mutex :
import "github.com/stevenctl/deadlog" // Before var mu sync. RWMutex // After var mu = deadlog . New ( deadlog . WithName ( "my-service" ))
The API is compatible with both sync.Mutex and sync.RWMutex :
// Write lock (sync.Mutex compatible) mu . Lock () defer mu . Unlock () // Read lock (sync.RWMutex compatible) mu . RLock () defer mu . RUnlock ()
Tracking unreleased locks
... continue reading