(subFS fs.ReadFileFS, dst map[string]*MutatorSpec)
| 30 | } |
| 31 | |
| 32 | func loadMutatorsFromFS(subFS fs.ReadFileFS, dst map[string]*MutatorSpec) { |
| 33 | if pl, ok := subFS.(fileloader.PathLister); ok { |
| 34 | for _, path := range pl.KnownPaths() { |
| 35 | if !strings.HasPrefix(path, `mutators/`) || !strings.HasSuffix(path, `.yaml`) { |
| 36 | continue |
| 37 | } |
| 38 | loadMutatorFileFromFS(subFS, path, dst) |
| 39 | } |
| 40 | return |
| 41 | } |
| 42 | |
| 43 | _ = fs.WalkDir(subFS, `mutators`, func(path string, d fs.DirEntry, err error) error { |
| 44 | if err != nil || d.IsDir() || !strings.HasSuffix(path, `.yaml`) { |
| 45 | return nil |
| 46 | } |
| 47 | loadMutatorFileFromFS(subFS, path, dst) |
| 48 | return nil |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | func loadMutatorFileFromFS(subFS fs.ReadFileFS, path string, dst map[string]*MutatorSpec) { |
| 53 | b, err := subFS.ReadFile(path) |
no test coverage detected