github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/util/unique/string_slice.go (about)

     1  package unique
     2  
     3  func StringSlice(input []string) []string {
     4  	result := make([]string, 0, len(input))
     5  	seen := make(map[string]struct{})
     6  	for _, v := range input {
     7  		if _, ok := seen[v]; !ok {
     8  			result = append(result, v)
     9  			seen[v] = struct{}{}
    10  		}
    11  	}
    12  	return result
    13  }