@@ -17,26 +17,31 @@ import (
1717 "github.com/operator-framework/operator-registry/internal/property"
1818)
1919
20- func LoadFS (configFS fs.FS ) (* DeclarativeConfig , error ) {
21- if configFS == nil {
20+ // LoadFS loads a declarative config from the provided root FS. LoadFS walks the
21+ // filesystem from root and uses a gitignore-style filename matcher to skip files
22+ // that match patterns found in .indexignore files found throughout the filesystem.
23+ // If LoadFS encounters an error loading or parsing any file, the error will be
24+ // immedidately returned.
25+ func LoadFS (root fs.FS ) (* DeclarativeConfig , error ) {
26+ if root == nil {
2227 return nil , fmt .Errorf ("no declarative config filesystem provided" )
2328 }
2429 cfg := & DeclarativeConfig {}
2530
26- matcher , err := ignore .NewMatcher (configFS , ".indexignore" )
31+ matcher , err := ignore .NewMatcher (root , ".indexignore" )
2732 if err != nil {
2833 return nil , err
2934 }
3035
31- if err := walkFiles (configFS , func (path string , r io.Reader ) error {
36+ if err := walkFiles (root , func (path string , r io.Reader ) error {
3237 if matcher .Match (path , false ) {
3338 return nil
3439 }
3540 fileCfg , err := readYAMLOrJSON (r )
3641 if err != nil {
3742 return fmt .Errorf ("could not load config file %q: %v" , path , err )
3843 }
39- if err := readBundleObjects (fileCfg .Bundles , configFS , path ); err != nil {
44+ if err := readBundleObjects (fileCfg .Bundles , root , path ); err != nil {
4045 return fmt .Errorf ("read bundle objects: %v" , err )
4146 }
4247 cfg .Packages = append (cfg .Packages , fileCfg .Packages ... )
0 commit comments