A deadlock occurs when concurrent executions remain blocked because each waits for an event or resource that cannot become available. In Go, mutex scope, channel buffering, and indirect function calls can create this condition. section 9.0 section 9.8.2
A formatter re-enters a locked mutex
The mistake is locking Customer before validating age, then formatting the receiver in the error. fmt.Errorf invokes String, but String tries to acquire the same mutex through RLock while UpdateAge still holds its write lock. Execution blocks; if every goroutine is asleep, Go reports `fatal error: all goroutines are asleep - deadlock!`.
Use the fix that matches the source of the lock dependency:
- Treat buffered channels cautiously: they allow sends to continue while capacity remains and can hide deadlocks that unbuffered channels expose immediately. section 9.7














