code: func newMockWriter() *mockWriter {
  	msgChan := make(chan string)
  	getChan := make(chan []string)
  	clearChan := make(chan struct{})
  	closeChan := make(chan struct{})
  	w := &mockWriter{
  		logged:    []string{},
  		msgChan:   msgChan,
  		getChan:   getChan,
  		clearChan: clearChan,
  		closeChan: closeChan,
  	}
  	go func() {
  		for {
  			select {
  			case logMsg := <-msgChan:
  				w.logged = append(w.logged, logMsg)
  			case getChan <- w.logged:
  			case <-clearChan:
  				w.logged = []string{}
  			case <-closeChan:
  				close(getChan)
  				return
  			}
  		}
  	}()
  	return w
  }
docs: // newMockWriter returns a new mockWriter