Skip to content

Commit 900623c

Browse files
author
a.groshev
committed
check
1 parent d4e47d2 commit 900623c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

application/App.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ func (a *Application) Dependency(dep func() *Dependency) {
5151
}
5252

5353
func (a *Application) Start() {
54+
var names []string
55+
var deps []string
5456
for _, dep := range a.deps {
5557
dependency := dep()
5658
fmt.Printf("Registering depndency %s with dependencies %s\n", dependency.name, dependency.deps)
@@ -64,6 +66,13 @@ func (a *Application) Start() {
6466
if dependency.start != nil {
6567
a.start[dependency.name] = dependency.start
6668
}
69+
names = append(names, dependency.name)
70+
deps = append(deps, dependency.deps...)
71+
}
72+
for _, dep := range deps {
73+
if !slices.Contains(names, dep) {
74+
panic(fmt.Sprintf("Dependency %s not found", dep))
75+
}
6776
}
6877
BuildInitSeq(a.depLists, &a.depSeq)
6978
for _, name := range a.depSeq {

0 commit comments

Comments
 (0)