Add SliceUniq
@@ -365,3 +365,17 @@ func Indirect(v reflect.Value) reflect.Value {
}
return v
}
+
+// SliceUniq removes duplicate values in given slice
+func SliceUniq(s []string) []string {
+ for i := 0; i < len(s); i++ {
+ for i2 := i + 1; i2 < len(s); i2++ {
+ if s[i] == s[i2] {
+ // delete
+ s = append(s[:i2], s[i2+1:]...)
+ i2--
+ }
+ }
+ }
+ return s
+}
