You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pattern we appear to have for Fx operations (Provide, Invoke, etc.)
take the form:
func (*module) thing(t thing)
func (m *module) thingAll() {
// perform module-local version of operation
for _, t := range m.things {
m.thing(t)
}
// recurse into children
for _, m := range m.modules {
m.${operation}All()
}
}
This means that the following two are equivalent:
// 1
for _, m := range app.modules {
m.thingAll()
}
// 2
app.root.thingAll()
Except (2) is DRYer.
This cleans up New by relying on root-level `*All` methods
instead of manually iterating over modules.
Making this change also highlighted that 'app.modules'
only ever has one entry: the root module.
So we can delete that field from App as well.
Finally, this also renames:
constructAllCustomLoggers -> installAllEventLoggers
constructCustomLogger -> installEventLogger
executeInvokes -> invokeAll
executeInvoke -> invoke
0 commit comments