func findDistribRelease()

in providers/linux/os.go [220:244]


func findDistribRelease(baseDir string) (*types.OSInfo, error) {
	matches, err := filepath.Glob(filepath.Join(baseDir, distribRelease))
	if err != nil {
		return nil, err
	}
	var errs []error
	for _, path := range matches {
		if strings.HasSuffix(path, osRelease) || strings.HasSuffix(path, lsbRelease) {
			continue
		}

		info, err := os.Stat(path)
		if err != nil || info.IsDir() || info.Size() == 0 {
			continue
		}

		osInfo, err := getDistribRelease(path)
		if err != nil {
			errs = append(errs, fmt.Errorf("in %s: %w", path, err))
			continue
		}
		return osInfo, nil
	}
	return nil, fmt.Errorf("no valid /etc/<distrib>-release file found: %w", errors.Join(errs...))
}