func applyValues()

in helmcli/release.go [63:89]


func applyValues(to, from map[string]interface{}) error {
	for k, v := range from {
		// If 'to' doesn't have key 'k'
		if _, checkKey := to[k]; !checkKey {
			to[k] = v
			continue
		}

		// If 'to' has key 'k'
		switch v := v.(type) {
		case map[string]interface{}:
			// If 'v' is of type map[string]interface{}
			if toMap, checkKey := to[k].(map[string]interface{}); checkKey {
				if err := applyValues(toMap, v); err != nil {
					return err
				}
			} else {
				to[k] = v

			}
		default:
			// If 'v' is not of type map[string]interface{}
			to[k] = v
		}
	}
	return nil
}