Skip to content

Commit 5b656a1

Browse files
committed
change LoadFS argument name back to root
Signed-off-by: Joe Lanford <[email protected]>
1 parent 87243eb commit 5b656a1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

internal/declcfg/load.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)