INNER CODE UNIT · Go
MakeSet
bjw-s-labs/helm-charts · tools/helm-schema-tools/internal/schema/schema.go:108
func MakeSet(slice []string) map[string]bool {
set := make(map[string]bool, len(slice))
for _, s := range slice {
set[s] = true
}
return set
}
// DeduplicateStrings returns a new slice with duplicates removed while
// preserving the order of first occurrence.
func DeduplicateStrings(in []string) []string {
seen := make(map[string]struct{}, len(in))
out := make([]string, 0, len(in))
for _, s := range in {
if _, ok := seen[s]; !ok {
seen[s] = struct{}{}
out = append(out, s)
}