PetrGaponov
10/4/2017 - 12:12 PM

gistfile1.txt

select {
    case ch <- 2: // Put 2 in the channel unless it is full
    default:
        fmt.Println("Channel full. Discarding value")
    }
    
    
    if len(ch) == cap(ch) {
    // Channel was full, but might not be by now
} else {
    // Channel wasn't full, but might be by now
}

https://stackoverflow.com/questions/25657207/golang-how-to-know-a-buffered-channel-is-full