github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/uniq.go (about) 1 package util 2 3 func MapKeys[K comparable, V any](m map[K]V) []K { 4 ret := []K{} 5 for x := range m { 6 ret = append(ret, x) 7 } 8 return ret 9 } 10 11 func Uniq[K comparable](in ...[]K) []K { 12 m := make(map[K]bool) 13 for _, a := range in { 14 for _, x := range a { 15 m[x] = true 16 } 17 } 18 return MapKeys(m) 19 }