loadModulesFromSomeMap loads modules from val, which must be a type of map[string]any. Depending on inlineModuleKey, it will be interpreted as either a ModuleMap (key is the module name) or as a regular map (key is not the module name, and module name is defined inline).
(namespace, inlineModuleKey string, val reflect.Value)
| 298 | // Depending on inlineModuleKey, it will be interpreted as either a ModuleMap (key is the module |
| 299 | // name) or as a regular map (key is not the module name, and module name is defined inline). |
| 300 | func (ctx Context) loadModulesFromSomeMap(namespace, inlineModuleKey string, val reflect.Value) (map[string]any, error) { |
| 301 | // if no inline_key is specified, then val must be a ModuleMap, |
| 302 | // where the key is the module name |
| 303 | if inlineModuleKey == "" { |
| 304 | if !isModuleMapType(val.Type()) { |
| 305 | panic(fmt.Sprintf("expected ModuleMap because inline_key is empty; but we do not recognize this type: %s", val.Type())) |
| 306 | } |
| 307 | return ctx.loadModuleMap(namespace, val) |
| 308 | } |
| 309 | |
| 310 | // otherwise, val is a map with modules, but the module name is |
| 311 | // inline with each value (the key means something else) |
| 312 | return ctx.loadModulesFromRegularMap(namespace, inlineModuleKey, val) |
| 313 | } |
| 314 | |
| 315 | // loadModulesFromRegularMap loads modules from val, where val is a map[string]json.RawMessage. |
| 316 | // Map keys are NOT interpreted as module names, so module names are still expected to appear |
no test coverage detected