github.com/argoproj/argo-cd@v1.8.7/server/project/util.go (about)

     1  package project
     2  
     3  func difference(a, b []string) []string {
     4  	return unique(append(a, b...))
     5  }
     6  
     7  func unique(slice []string) []string {
     8  	encountered := map[string]int{}
     9  	for _, v := range slice {
    10  		encountered[v] = encountered[v] + 1
    11  	}
    12  
    13  	diff := make([]string, 0)
    14  	for _, v := range slice {
    15  		if encountered[v] == 1 {
    16  			diff = append(diff, v)
    17  		}
    18  	}
    19  	return diff
    20  }