code: func setConditionInList(inputList []autoscalingv2.HorizontalPodAutoscalerCondition, conditionType autoscalingv2.HorizontalPodAutoscalerConditionType, status v1.ConditionStatus, reason, message string, args ...interface{}) []autoscalingv2.HorizontalPodAutoscalerCondition {
  	resList := inputList
  	var existingCond *autoscalingv2.HorizontalPodAutoscalerCondition
  	for i, condition := range resList {
  		if condition.Type == conditionType {
  			// can't take a pointer to an iteration variable
  			existingCond = &resList[i]
  			break
  		}
  	}
  
  	if existingCond == nil {
  		resList = append(resList, autoscalingv2.HorizontalPodAutoscalerCondition{
  			Type: conditionType,
  		})
  		existingCond = &resList[len(resList)-1]
  	}
  
  	if existingCond.Status != status {
  		existingCond.LastTransitionTime = metav1.Now()
  	}
  
  	existingCond.Status = status
  	existingCond.Reason = reason
  	existingCond.Message = fmt.Sprintf(message, args...)
  
  	return resList
  }
docs: // setConditionInList sets the specific condition type on the given HPA to the specified value with the given
  // reason and message.  The message and args are treated like a format string.  The condition will be added if
  // it is not present.  The new list will be returned.