# panic: select on closed channel

- **ID:** `go/select-random-choice`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A select statement includes a case that sends to a closed channel, causing a panic when selected.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   Before sending, check if channel is closed using a separate mechanism: 

select {
case <-done:
    return
case ch <- v:
}
// Ensure done is closed before ch is closed.
   ```
2. **** (85% success)
   ```
   Use a separate struct with a mutex to manage channel state, or use a single producer that closes the channel.
   ```

## Dead Ends

- **** — If the channel is closed dynamically, it can't be removed at compile time. (50% fail)
- **** — Default case doesn't prevent panic when sending on a closed channel that is selected. (80% fail)
