Channel Close Detection

2025-01-153 minTech Related
#golang

Go tells you when a channel is closed.

range exits automatically on close.

Example:

for v := range ch {
    fmt.Println(v)
}