清理代码 & 支持 ignore
This commit is contained in:
15
pkg/utils/array.go
Normal file
15
pkg/utils/array.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
func ClearDuplicates[T comparable](slice []T) []T {
|
||||
seen := make(map[T]bool)
|
||||
for _, val := range slice {
|
||||
seen[val] = true
|
||||
}
|
||||
|
||||
var result []T
|
||||
for key := range seen {
|
||||
result = append(result, key)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user