MCPcopy Create free account
hub / github.com/compose-spec/compose-go / loadIncludeConfig

Function loadIncludeConfig

loader/include.go:34–52  ·  view source on GitHub ↗

loadIncludeConfig parse the required config from raw yaml

(source any)

Source from the content-addressed store, hash-verified

32
33// loadIncludeConfig parse the required config from raw yaml
34func loadIncludeConfig(source any) ([]types.IncludeConfig, error) {
35 if source == nil {
36 return nil, nil
37 }
38 configs, ok := source.([]any)
39 if !ok {
40 return nil, fmt.Errorf("`include` must be a list, got %s", source)
41 }
42 for i, config := range configs {
43 if v, ok := config.(string); ok {
44 configs[i] = map[string]any{
45 "path": v,
46 }
47 }
48 }
49 var requires []types.IncludeConfig
50 err := Transform(source, &requires)
51 return requires, err
52}
53
54func ApplyInclude(ctx context.Context, workingDir string, environment types.Mapping, model map[string]any, options *Options, included []string, processor PostProcessor) error {
55 includeConfig, err := loadIncludeConfig(model["include"])

Callers 1

ApplyIncludeFunction · 0.85

Calls 1

TransformFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…