code: func CQ(c context.Context, cfg *pb.Config) error {
  	// Normalize each ConfigGroup individually first.
  	for _, cg := range cfg.ConfigGroups {
  		for _, g := range cg.Gerrit {
  			normalizeGerrit(g)
  		}
  		sort.Slice(cg.Gerrit, func(i, j int) bool {
  			return cg.Gerrit[i].Url < cg.Gerrit[j].Url
  		})
  		if cg.Verifiers != nil {
  			normalizeGerritCqAbility(cg.Verifiers.GerritCqAbility)
  			normalizeTryjobs(cg.Verifiers.Tryjob)
  		}
  	}
  
  	// Sort by some synthetic key. It doesn't really matter what it is exactly as
  	// long as the final ordering is "stable" across multiple invocations. Note
  	// that we rely here on sorting of Gerrit/Project/Refs done above.
  	sortKeys := make(map[*pb.ConfigGroup]string, len(cfg.ConfigGroups))
  	for _, cg := range cfg.ConfigGroups {
  		sortKeys[cg] = cgSortKey(cg)
  	}
  	sort.Slice(cfg.ConfigGroups, func(i, j int) bool {
  		return sortKeys[cfg.ConfigGroups[i]] < sortKeys[cfg.ConfigGroups[j]]
  	})
  
  	return nil
  }
docs: // CQ normalizes cq.cfg config.