code: func ValidateACLSets(ctx *validation.Context, sets []*messages.AclSet) Sets {
  	as := make(Sets, len(sets))
  	reportedDups := stringset.New(len(sets))
  	for _, s := range sets {
  		_, isDup := as[s.Name]
  		validName := false
  		switch {
  		case s.Name == "":
  			ctx.Errorf("missing 'name' field'")
  		case !aclSetNameRe.MatchString(s.Name):
  			ctx.Errorf("%q is not valid value for 'name' field", s.Name)
  		case isDup:
  			if reportedDups.Add(s.Name) {
  				// Report only first dup.
  				ctx.Errorf("aclSet name %q is not unique", s.Name)
  			}
  		default:
  			validName = true
  		}
  		// record this error regardless of whether name is valid or not
  		if len(s.GetAcls()) == 0 {
  			ctx.Errorf("aclSet %q has no entries", s.Name)
  		} else if validName {
  			// add if and only if it is valid
  			as[s.Name] = s.GetAcls()
  		}
  	}
  	return as
  }
docs: // ValidateACLSets validates list of AclSet of a project and returns Sets.
  //
  // Errors are returned via validation.Context.