func()

in internal/processor/processor.go [134:169]


func (client *ProcessorClient) Process(res *Result) error {
	// Open the metadata file and store contents in the result
	metad, err := client.Metadata()
	if err != nil {
		return fmt.Errorf("ProcessorClient.Process: error getting metadata: %w", err)
	}
	res.Metadata = metad

	// Walk the embedded lib FS and process files
	if err := fs.WalkDir(client.fs, ".", func(path string, d fs.DirEntry, err error) error {
		if err != nil {
			return fmt.Errorf("ProcessorClient.Process: error walking directory %s: %w", path, err)
		}
		// Skip directories
		if d.IsDir() {
			return nil
		}
		// Skip files where path contains base of the `ALZLIB_DIR`.
		alzLibDirBase := filepath.Base(environment.AlzLibDir())
		if strings.Contains(path, alzLibDirBase) {
			return nil
		}
		// Skip files that are not json or yaml
		if !slices.Contains(supportedFileTypes, strings.ToLower(filepath.Ext(path))) {
			return nil
		}
		file, err := client.fs.Open(path)
		if err != nil {
			return fmt.Errorf("ProcessorClient.Process: error opening file %s: %w", path, err)
		}
		return classifyLibFile(res, file, d.Name())
	}); err != nil {
		return err
	}
	return nil
}