code: func (ch *Channel) shutdown(e *Error) {
  	ch.destructor.Do(func() {
  		ch.m.Lock()
  		defer ch.m.Unlock()
  
  		// Grab an exclusive lock for the notify channels
  		ch.notifyM.Lock()
  		defer ch.notifyM.Unlock()
  
  		// Broadcast abnormal shutdown
  		if e != nil {
  			for _, c := range ch.closes {
  				c <- e
  			}
  		}
  
  		// Signal that from now on, Channel.send() should call
  		// Channel.sendClosed()
  		atomic.StoreInt32(&ch.closed, 1)
  
  		// Notify RPC if we're selecting
  		if e != nil {
  			ch.errors <- e
  		}
  
  		ch.consumers.close()
  
  		for _, c := range ch.closes {
  			close(c)
  		}
  
  		for _, c := range ch.flows {
  			close(c)
  		}
  
  		for _, c := range ch.returns {
  			close(c)
  		}
  
  		for _, c := range ch.cancels {
  			close(c)
  		}
  
  		// Set the slices to nil to prevent the dispatch() range from sending on
  		// the now closed channels after we release the notifyM mutex
  		ch.flows = nil
  		ch.closes = nil
  		ch.returns = nil
  		ch.cancels = nil
  
  		if ch.confirms != nil {
  			ch.confirms.Close()
  		}
  
  		close(ch.errors)
  		ch.noNotify = true
  	})
  }
docs: // shutdown is called by Connection after the channel has been removed from the
  // connection registry.