code: func (m *multiWriter) Write(p []byte) (n int, err error) {
  	// lock and make a local copy of available writers:
  	getWriters := func() (writers []writerWrapper) {
  		m.RLock()
  		defer m.RUnlock()
  		writers = make([]writerWrapper, 0, len(m.writers))
  		for _, w := range m.writers {
  			writers = append(writers, w)
  		}
  
  		// add the recent write chunk to the "instant replay" buffer
  		// of the session, to be replayed to newly joining parties:
  		m.lockedAddRecentWrite(p)
  		return writers
  	}
  
  	// unlock and multiplex the write to all writers:
  	for _, w := range getWriters() {
  		n, err = w.Write(p)
  		if err != nil {
  			if w.closeOnError {
  				return
  			}
  			continue
  		}
  		if n != len(p) {
  			err = io.ErrShortWrite
  			return
  		}
  	}
  	return len(p), nil
  }
docs: // Write multiplexes the input to multiple sub-writers. The entire point
  // of multiWriter is to do this