(filenames []string, images []string, tempDir string)
| 14 | var allowedExtensions = []string{gator.ExtYAML, gator.ExtYML, gator.ExtJSON} |
| 15 | |
| 16 | func ReadSources(filenames []string, images []string, tempDir string) ([]*unstructured.Unstructured, error) { |
| 17 | var sources []*source |
| 18 | |
| 19 | // Read from --filename flag |
| 20 | s, err := readFiles(filenames) |
| 21 | if err != nil { |
| 22 | return nil, fmt.Errorf("reading from filenames: %w", err) |
| 23 | } |
| 24 | sources = append(sources, s...) |
| 25 | |
| 26 | // Read from --image flag |
| 27 | s, err = readImages(images, tempDir) |
| 28 | if err != nil { |
| 29 | return nil, fmt.Errorf("pulling image: %w", err) |
| 30 | } |
| 31 | sources = append(sources, s...) |
| 32 | |
| 33 | // Read stdin |
| 34 | stdinUnstructs, err := readStdin() |
| 35 | if err != nil { |
| 36 | return nil, fmt.Errorf("reading from stdin: %w", err) |
| 37 | } |
| 38 | sources = append(sources, &source{stdin: true, objs: stdinUnstructs}) |
| 39 | |
| 40 | conflicts := detectConflicts(sources) |
| 41 | for i := range conflicts { |
| 42 | logConflict(&conflicts[i]) |
| 43 | } |
| 44 | |
| 45 | return sourcesToUnstruct(sources), nil |
| 46 | } |
| 47 | |
| 48 | func readImage(image string, tempDir string) ([]*source, error) { |
| 49 | dirPath, closeHandler, err := oci.PullImage(image, tempDir) |
no test coverage detected
searching dependent graphs…