simplify map key check

Signed-off-by: Lucas Medeiros <lucas@lucasmdrs.com>
pull/9881/head
Lucas Medeiros 4 years ago
parent 5e44291a37
commit 5487faabf1
No known key found for this signature in database
GPG Key ID: D3993AFC1442399F

@ -899,13 +899,13 @@ func key(name string) (string, error) {
// removeDuplicates remove entries with the same name or unique key // removeDuplicates remove entries with the same name or unique key
func removeDuplicates(re []*repo.Entry) []*repo.Entry { func removeDuplicates(re []*repo.Entry) []*repo.Entry {
m := make(map[string]struct{}) m := map[string]bool{}
uniq := make([]*repo.Entry, 0) uniq := []*repo.Entry{}
for _, r := range re { for _, r := range re {
if _, ok := m[r.Name]; ok { if m[r.Name] {
continue continue
} }
m[r.Name] = struct{}{} m[r.Name] = true
uniq = append(uniq, r) uniq = append(uniq, r)
} }

Loading…
Cancel
Save