# panic: send on closed channel

- **ID:** `go/channel-close-on-sender-panic`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Sending to a channel after it has been closed causes a runtime panic.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |

## Workarounds

1. **** (85% success)
   ```
   ch := make(chan int)
close(ch)
// Use select with a done channel to avoid sending after close
select {
case ch <- 1:
default:
    fmt.Println("channel closed")
}
   ```
2. **** (90% success)
   ```
   var mu sync.RWMutex
closed := false
// In sender:
mu.RLock()
if !closed { ch <- 1 }
mu.RUnlock()
// In closer:
mu.Lock()
close(ch)
closed = true
mu.Unlock()
   ```

## Dead Ends

- **** — Recovery doesn't prevent data loss or inconsistency; the sender state is corrupted. (60% fail)
- **** — len() doesn't indicate closed status; a closed channel can still have buffered items. (80% fail)
- **** — Mutex doesn't prevent closing while sending; race condition remains. (50% fail)
