Merge changes I516c984b,I2b3354de

* changes:
  comment on how glob files are written
  cosmetic: use map[_]struct{}  for set semantics
This commit is contained in:
Treehugger Robot 2022-12-21 15:44:42 +00:00 committed by Gerrit Code Review
commit a405cf7f6a
2 changed files with 4 additions and 2 deletions

View file

@ -237,6 +237,8 @@ func generateGlobNinjaFile(glob *GlobSingleton, config interface{}) ([]byte, []e
return nil, errs return nil, errs
} }
// PrepareBuildActions() will write $OUTDIR/soong/globs/$m/$i files
// where $m=bp2build|build and $i=0..numGlobBuckets
extraDeps, errs = ctx.PrepareBuildActions(config) extraDeps, errs = ctx.PrepareBuildActions(config)
if len(extraDeps) > 0 { if len(extraDeps) > 0 {
return nil, []error{fmt.Errorf("shouldn't have extra deps")} return nil, []error{fmt.Errorf("shouldn't have extra deps")}

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
} }