func()

in cost-optimization/gke-shift-left-cost/api/manifests.go [42:62]


func (m *Manifests) LoadObjectsFromPath(path string, conf CostimatorConfig) error {
	err := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {
		if !f.IsDir() {
			if strings.HasSuffix(path, ".yaml") || strings.HasSuffix(path, ".yml") {
				data, err := ioutil.ReadFile(path)
				if err != nil {
					return err
				}
				log.Tracef("Loading yaml file '%s'", path)
				return m.LoadObjects(data, conf)
			}
			log.Tracef("Skipping non yaml file '%s'", path)
		}
		return nil
	})

	if err != nil {
		return err
	}
	return nil
}