Attempting to send data into a channel that has already been closed.
Closing a Go channel signals receivers that no more values will be sent. Sending a value `ch <- val` to a closed channel causes an immediate runtime panic.
Multiple concurrent writer goroutines where one closes the channel while others are still sending.
1package main2 3func main() {4 ch := make(chan int, 2)5 close(ch)6 ch <- 10 // Panic: send on closed channel7}1package main2 3import "sync"4 5func main() {6 ch := make(chan int, 2)7 var wg sync.WaitGroup8 9 wg.Add(1)10 go func() {11 defer wg.Done()12 ch <- 1013 }()14 15 wg.Wait()16 close(ch) // Close channel ONLY after all senders complete17}Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
Once `close(ch)` is invoked, `ch` rejects all subsequent send operations.