code: func (sl *StoreLimits) Build() error {
  	// Check that there is no negative value
  	if err := sl.checkGlobalLimits(); err != nil {
  		return err
  	}
  	// If there is no per-channel, we are done.
  	if len(sl.PerChannel) == 0 {
  		return nil
  	}
  	literals := 0
  	sublist := util.NewSublist()
  	for cn, cl := range sl.PerChannel {
  		if !util.IsChannelNameValid(cn, true) {
  			return fmt.Errorf("invalid channel name %q", cn)
  		}
  		isLiteral := util.IsChannelNameLiteral(cn)
  		if isLiteral {
  			literals++
  			if sl.MaxChannels > 0 && literals > sl.MaxChannels {
  				return fmt.Errorf("too many channels defined (%v). The max channels limit is set to %v",
  					literals, sl.MaxChannels)
  			}
  		}
  		cli := &channelLimitInfo{
  			name:      cn,
  			limits:    cl,
  			isLiteral: isLiteral,
  		}
  		sublist.Insert(cn, cli)
  	}
  	// If we are here, it means that there was no error,
  	// so we now apply inheritance.
  	sl.applyInheritance(sublist)
  	return nil
  }
docs: // Build sets the global limits into per-channel limits that are set
  // to zero. This call also validates the limits. An error is returned if:
  // * any global limit is set to a negative value.
  // * the number of per-channel is higher than StoreLimits.MaxChannels.
  // * a per-channel name is invalid