MCPcopy
hub / github.com/uber-go/fx / build

Method build

module.go:150–171  ·  view source on GitHub ↗

builds the Scopes using the App's Container. Note that this happens after applyModules' are called because the App's Container needs to be built for any Scopes to be initialized, and applys' should be called before the Container can get initialized.

(app *App, root *dig.Container)

Source from the content-addressed store, hash-verified

148// be built for any Scopes to be initialized, and applys' should be called
149// before the Container can get initialized.
150func (m *module) build(app *App, root *dig.Container) {
151 if m.parent == nil {
152 m.scope = root
153 } else {
154 parentScope := m.parent.scope
155 m.scope = parentScope.Scope(m.name)
156 // use parent module's logger by default
157 m.log = m.parent.log
158 }
159
160 if m.logConstructor != nil {
161 // Since user supplied a custom logger, use a buffered logger
162 // to hold all messages until user supplied logger is
163 // instantiated. Then we flush those messages after fully
164 // constructing the custom logger.
165 m.fallbackLogger, m.log = m.log, new(logBuffer)
166 }
167
168 for _, mod := range m.modules {
169 mod.build(app, root)
170 }
171}
172
173func (m *module) provideAll() {
174 for _, p := range m.provides {

Callers

nothing calls this directly

Calls 2

ScopeMethod · 0.80
buildMethod · 0.65

Tested by

no test coverage detected