code: func (c *chanList) add(ch *channel) uint32 {
  	c.Lock()
  	defer c.Unlock()
  	for i := range c.chans {
  		if c.chans[i] == nil {
  			c.chans[i] = ch
  			return uint32(i) + c.offset
  		}
  	}
  	c.chans = append(c.chans, ch)
  	return uint32(len(c.chans)-1) + c.offset
  }
docs: // Assigns a channel ID to the given channel.