mirror of
https://github.com/EnumeratedDev/bpm.git
synced 2026-09-16 10:36:12 +00:00
Remove duplicate strings in packages slice from install and remove operations
This commit is contained in:
@@ -134,6 +134,18 @@ func bytesToHumanReadable(b int64) string {
|
||||
return fmt.Sprintf("%.1fYiB", bf)
|
||||
}
|
||||
|
||||
func removeDuplicates[T comparable](sliceList []T) []T {
|
||||
allKeys := make(map[T]bool)
|
||||
list := []T{}
|
||||
for _, item := range sliceList {
|
||||
if _, value := allKeys[item]; !value {
|
||||
allKeys[item] = true
|
||||
list = append(list, item)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
func CompareVersions(version1, version2 string) int {
|
||||
v1 := version.NewVersion(version1)
|
||||
v2 := version.NewVersion(version2)
|
||||
|
||||
Reference in New Issue
Block a user