func appendMounts()

in plugins/internal/plugin/plugin_configuration.go [40:70]


func appendMounts(mounts map[string][]*discovery.RuntimeFile, defaults map[string][]*discovery.RuntimeFile) map[string][]*discovery.RuntimeFile {

	// Gather the set of unique vendor names, converting all names to lower case
	vendors := make(map[string]bool)
	for _, vendor := range append(maps.Keys(mounts), maps.Keys(defaults)...) {
		vendorLower := strings.ToLower(vendor)
		if !vendors[vendorLower] {
			vendors[vendorLower] = true
		}
	}

	// Process the mounts for each vendor in turn
	appended := make(map[string][]*discovery.RuntimeFile)
	for vendor := range vendors {
		appended[vendor] = []*discovery.RuntimeFile{}

		// Add the mounts for the vendor if we have any
		vendorMounts, haveMounts := mounts[vendor]
		if haveMounts {
			appended[vendor] = append(appended[vendor], vendorMounts...)
		}

		// Add the defaults for the vendor if we have any
		vendorDefaults, haveDefaults := defaults[vendor]
		if haveDefaults {
			appended[vendor] = append(appended[vendor], vendorDefaults...)
		}
	}

	return appended
}