type Unbounded … // NewUnbounded returns a new instance of Unbounded. func NewUnbounded() *Unbounded { … } var errBufferClosed … // Put adds t to the unbounded buffer. func (b *Unbounded) Put(t any) error { … } // Load sends the earliest buffered data, if any, onto the read channel returned // by Get(). Users are expected to call this every time they successfully read a // value from the read channel. func (b *Unbounded) Load() { … } // Get returns a read channel on which values added to the buffer, via Put(), // are sent on. // // Upon reading a value from this channel, users are expected to call Load() to // send the next buffered value onto the channel if there is any. // // If the unbounded buffer is closed, the read channel returned by this method // is closed after all data is drained. func (b *Unbounded) Get() <-chan any { … } // Close closes the unbounded buffer. No subsequent data may be Put(), and the // channel returned from Get() will be closed after all the data is read and // Load() is called for the final time. func (b *Unbounded) Close() { … }