// Load will read the file at the given path and attempt to return a component object. func Load(path string) (common.Component, error) { // Get file system assistance. fs := fs.OSUtil{} // Read the component file. fileName := filepath.Join(path, "component.yaml") componentData, err := fs.OpenAndReadFile(fileName) if err != nil { return nil, errors.New(constants.ErrComponentFileDNE) } // Parse the component. var component common.Component component, err = parseComponent(componentData, fileName) if err != nil { return nil, err } // Ensure we have a key for the component. if component.GetKey() == "" { component.SetKey(getKey(path)) } return component, nil }