MCPcopy Create free account
hub / github.com/buildpacks/pack / ReadConfig

Function ReadConfig

builder/config_reader.go:100–119  ·  view source on GitHub ↗

ReadConfig reads a builder configuration from the file path provided and returns the configuration along with any warnings encountered while parsing

(path string)

Source from the content-addressed store, hash-verified

98// ReadConfig reads a builder configuration from the file path provided and returns the
99// configuration along with any warnings encountered while parsing
100func ReadConfig(path string) (config Config, warnings []string, err error) {
101 file, err := os.Open(filepath.Clean(path))
102 if err != nil {
103 return Config{}, nil, errors.Wrap(err, "opening config file")
104 }
105 defer file.Close()
106
107 config, err = parseConfig(file)
108 if err != nil {
109 return Config{}, nil, errors.Wrapf(err, "parse contents of '%s'", path)
110 }
111
112 if len(config.Order) == 0 {
113 warnings = append(warnings, fmt.Sprintf("empty %s definition", style.Symbol("order")))
114 }
115
116 config.mergeStackWithImages()
117
118 return config, warnings, nil
119}
120
121// ValidateConfig validates the config
122func ValidateConfig(c Config) error {

Callers 3

BuilderCreateFunction · 0.92
CreateBuilderFunction · 0.92
testConfigFunction · 0.92

Calls 4

parseConfigFunction · 0.85
mergeStackWithImagesMethod · 0.80
OpenMethod · 0.65
CloseMethod · 0.65

Tested by 1

testConfigFunction · 0.74