code: func mergeEnv(envVars []api.EnvVar, podPresets []*settingsv1alpha1.PodPreset) ([]api.EnvVar, error) {
  	origEnv := map[string]api.EnvVar{}
  	for _, v := range envVars {
  		origEnv[v.Name] = v
  	}
  
  	mergedEnv := make([]api.EnvVar, len(envVars))
  	copy(mergedEnv, envVars)
  
  	var errs []error
  
  	for _, pp := range podPresets {
  		for _, v := range pp.Spec.Env {
  			internalEnv := api.EnvVar{}
  			if err := apiscorev1.Convert_v1_EnvVar_To_core_EnvVar(&v, &internalEnv, nil); err != nil {
  				return nil, err
  			}
  
  			found, ok := origEnv[v.Name]
  			if !ok {
  				// if we don't already have it append it and continue
  				origEnv[v.Name] = internalEnv
  				mergedEnv = append(mergedEnv, internalEnv)
  				continue
  			}
  
  			// make sure they are identical or throw an error
  			if !reflect.DeepEqual(found, internalEnv) {
  				errs = append(errs, fmt.Errorf("merging env for %s has a conflict on %s: \n%#v\ndoes not match\n%#v\n in container", pp.GetName(), v.Name, v, found))
  			}
  		}
  	}
  
  	err := utilerrors.NewAggregate(errs)
  	if err != nil {
  		return nil, err
  	}
  
  	return mergedEnv, err
  }
docs: // mergeEnv merges a list of env vars with the env vars injected by given list podPresets.
  // It returns an error if it detects any conflict during the merge.