# Deadlog – almost drop-in mutex for debugging Go deadlocks

I've done this same println debugging thing so many times, along with some sed/awk stuff to figure out which call was causing the issue. Now it's a small Go package. With some `runtime.Callers` I can usually find the spot by just swapping the existing Mutex or RWMutex for this one. Sometimes I swit…

- **Page:** https://magpie.gallery/i/deadlog-almost-drop-in-mutex-for-debugging-go-dead-1dwx
- **Type:** Link to an idea elsewhere
- **Category:** AI & dev
- **Tags:** go, deadlock, mutex, debugging

## Source

Web · dirteater_: Deadlog – almost drop-in mutex for debugging Go deadlocks

- **Original:** https://news.ycombinator.com/item?id=46963736

> I've done this same println debugging thing so many times, along with some sed/awk stuff to figure out which call was causing the issue. Now it's a small Go package. With some `runtime.Callers` I can usually find the spot by just swapping the existing Mutex or RWMutex for this one. Sometimes I switch the mu.Lock() defer mu.Unlock() with the LockFunc/RLockFunc to get more detail defer mu.LockFunc()() I almost always initialize it with `deadlog.New(deadlog.WithTrace(1))` and that's plenty. Not the most polished library, but it's not supposed to land in any commit, just a temporary debugging aid. I find it useful. https://github.com/stevenctl/deadlog

## GitHub projects

- https://github.com/stevenctl/deadlog

## Rules for reuse

- Build your own version: don't copy another product's code, look, icons, colours or copy.
- The original belongs to its author; Magpie only links to it.
- The original content's copyright belongs to its creator. Magpie doesn't download or re-upload it; we only show the link and the official preview.
