MCPcopy Index your code
hub / github.com/commitdev/zero / loadAllModules

Function loadAllModules

internal/init/init.go:84–104  ·  view source on GitHub ↗

loadAllModules takes a list of module sources, downloads those modules, and parses their config

(moduleSources []string)

Source from the content-addressed store, hash-verified

82
83// loadAllModules takes a list of module sources, downloads those modules, and parses their config
84func loadAllModules(moduleSources []string) (map[string]moduleconfig.ModuleConfig, map[string]string) {
85 modules := make(map[string]moduleconfig.ModuleConfig)
86 mappedSources := make(map[string]string)
87
88 wg := sync.WaitGroup{}
89 wg.Add(len(moduleSources))
90 for _, moduleSource := range moduleSources {
91 go module.FetchModule(moduleSource, &wg)
92 }
93 wg.Wait()
94
95 for _, moduleSource := range moduleSources {
96 mod, err := module.ParseModuleConfig(moduleSource)
97 if err != nil {
98 exit.Fatal("Unable to load module (%s): %v\n", moduleSource, err)
99 }
100 modules[mod.Name] = mod
101 mappedSources[mod.Name] = moduleSource
102 }
103 return modules, mappedSources
104}
105
106// Project name is prompt individually because the rest of the prompts
107// requires the projectName to populate defaults

Callers 1

InitFunction · 0.85

Calls 3

FetchModuleFunction · 0.92
ParseModuleConfigFunction · 0.92
FatalFunction · 0.92

Tested by

no test coverage detected