code: func (b *limitedBuffer) Write(data []byte) (int, error) {
  	b.mu.Lock()
  	defer b.mu.Unlock()
  
  	bufLen := b.buf.Len()
  	dataLen := len(data)
  	keep := min(maxOutputLen-bufLen, dataLen)
  	if keep > 0 {
  		b.buf.Write(data[:keep])
  	}
  	if keep < dataLen {
  		b.truncated = true
  	}
  	return dataLen, nil
  }
docs: // Append to limitedBuffer while there is room.