Tech News
← Back to articles

Show HN: Deadlog – almost drop-in mutex for debugging Go deadlocks

read original related products more articles

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