code: func (b *Buffer) Write(buf []byte) (int, error) {
  	// Account for total bytes written
  	n := len(buf)
  	b.written += int64(n)
  
  	// If the buffer is larger than ours, then we only care
  	// about the last size bytes anyways
  	if int64(n) > b.size {
  		buf = buf[int64(n)-b.size:]
  	}
  
  	// Copy in place
  	remain := b.size - b.writeCursor
  	copy(b.data[b.writeCursor:], buf)
  	if int64(len(buf)) > remain {
  		copy(b.data, buf[remain:])
  	}
  
  	// Update location of the cursor
  	b.writeCursor = ((b.writeCursor + int64(len(buf))) % b.size)
  	return n, nil
  }
docs: // Write writes up to len(buf) bytes to the internal ring,
  // overriding older data if necessary.