cosmetic: use map[_]struct{} for set semantics

Bug: NA
Test: `m nothing` then view soong_metrics
Change-Id: I2b3354de3259ffef9ae881d59ac844fb518074f2
This commit is contained in:
Usta Shrestha 2022-12-20 17:28:05 -05:00
parent 9bc3a984d7
commit 09e0dd2ec9

View file

@ -98,12 +98,12 @@ func (h *EventHandler) CompletedEvents() []Event {
h.scopeIds)) h.scopeIds))
} }
// Validate no two events have the same full id. // Validate no two events have the same full id.
ids := map[string]bool{} ids := map[string]struct{}{}
for _, event := range h.completedEvents { for _, event := range h.completedEvents {
if _, containsId := ids[event.Id]; containsId { if _, containsId := ids[event.Id]; containsId {
panic(fmt.Errorf("Duplicate event registered: %s", event.Id)) panic(fmt.Errorf("Duplicate event registered: %s", event.Id))
} }
ids[event.Id] = true ids[event.Id] = struct{}{}
} }
return h.completedEvents return h.completedEvents
} }