MCPcopy
hub / github.com/yusing/godoxy / dedupDependencies

Method dedupDependencies

internal/idlewatcher/watcher.go:640–657  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

638}
639
640func (w *Watcher) dedupDependencies() {
641 // remove from dependencies if the dependency is also a dependency of another dependency, or have duplicates.
642 deps := w.dependencies()
643 for _, dep := range w.dependsOn {
644 depdeps := dep.dependencies()
645 for depdep := range depdeps.Iter {
646 deps.Del(depdep)
647 }
648 }
649 newDepOn := make([]string, 0, deps.Len())
650 newDeps := make([]*dependency, 0, deps.Len())
651 for _, dep := range deps.Iter {
652 newDepOn = append(newDepOn, dep.cfg.ContainerName())
653 newDeps = append(newDeps, dep)
654 }
655 w.cfg.DependsOn = newDepOn
656 w.dependsOn = newDeps
657}
658
659func (w *Watcher) dependencies() *ordered.Map[string, *dependency] {
660 deps := ordered.NewMap[string, *dependency]()

Callers 1

NewWatcherFunction · 0.80

Calls 4

dependenciesMethod · 0.95
ContainerNameMethod · 0.80
DelMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected