terraform-provider-gitea/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/terraform/util.go
Tobias Trabelsi e1266ebf64
Some checks reported errors
continuous-integration/drone/pr Build encountered an error
continuous-integration/drone/push Build encountered an error
updated GHA
Update to v2 SDK
updated dependencies
2022-08-06 16:21:18 +02:00

23 lines
344 B
Go

package terraform
import (
"sort"
)
// deduplicate a slice of strings
func uniqueStrings(s []string) []string {
if len(s) < 2 {
return s
}
sort.Strings(s)
result := make([]string, 1, len(s))
result[0] = s[0]
for i := 1; i < len(s); i++ {
if s[i] != result[len(result)-1] {
result = append(result, s[i])
}
}
return result
}