findYamlFiles finds all YAML files in the specified directory. It includes files with both .yaml and .yml extensions.
(dir string)
| 272 | // findYamlFiles finds all YAML files in the specified directory. |
| 273 | // It includes files with both .yaml and .yml extensions. |
| 274 | func findYamlFiles(dir string) ([]string, error) { |
| 275 | yamlFiles, err := filepath.Glob(filepath.Join(dir, "*.yaml")) |
| 276 | if err != nil { |
| 277 | return nil, fmt.Errorf("failed to find YAML files in %s: %w", dir, err) |
| 278 | } |
| 279 | |
| 280 | ymlFiles, err := filepath.Glob(filepath.Join(dir, "*.yml")) |
| 281 | if err != nil { |
| 282 | return nil, fmt.Errorf("failed to find YML files in %s: %w", dir, err) |
| 283 | } |
| 284 | |
| 285 | return slices.Concat(yamlFiles, ymlFiles), nil |
| 286 | } |