func (fg featureFlag) SetFeatureFlag(features []string) error {
	if len(features) == 0 {
		klog.V(4).Info("No feature flags are set, default values will be used")
	}
	// iterate through each feature and set its state onto the featureFlag map
	for _, feature := range features {
		var f Feature
		// by default if a feature gate is provided, it is enabled
		isEnabled := true
		// if the feature is specified in the format
		// MyFeature=false, the string need to be parsed and
		// corresponding state to be set on the feature
		s := strings.Split(feature, "=")
		f = Feature(s[0])
		// only if length after splitting =2, we need to check whether the
		// feature is enabled or disabled
		if len(s) == 2 {
			isEnabled = util.CheckTruthy(s[1])
		} else if len(s) > 2 {
			// if length > 2 , there is some error in the format specified
			return fmt.Errorf("incorrect format. cannot parse feature %s", feature)
		}
		// check if the feature flag provided is available in the list of
		// supported features
		if !containsFeature(supportedFeatures, f) {
			return fmt.Errorf("unknown feature flag %s", f)
		}
		fg[f] = isEnabled
	}

	for k, v := range fg {
		klog.Infof("Feature gate: %s, state: %s", k, util.StateStatus(v))
	}

	return nil
}
// SetFeatureFlag parses a slice of string and sets the feature flag.
SetFeatureFlag parses a slice of string and sets the feature flag.
// SetFeatureFlag parses a slice of string and sets the feature flag .
func (fg featureFlag) SetFeatureFlag(features []string) error {
	if len(features) == 0 {
		klog.V(4).Info("No feature flags are set, default values will be used")
	}
	for _, feature := range features {
		var f Feature
		isEnabled := true
		s := strings.Split(feature, "=")
		f = Feature(s[0])
		if len(s) == 2 {
			isEnabled = util.CheckTruthy(s[1])
		} else if len(s) > 2 {
			return fmt.Errorf("incorrect format. cannot parse feature %s", feature)
		}
		if !containsFeature(supportedFeatures, f) {
			return fmt.Errorf("unknown feature flag %s", f)
		}
		fg[f] = isEnabled
	}
	for k, v := range fg {
		klog.Infof("Feature gate: %s, state: %s", k, util.StateStatus(v))
	}
	return nil
}
func ( fg featureFlag ) SetFeatureFlag ( features [ ] string ) error { if len ( features ) == 0 { klog . V ( 4 ) . Info ( " " ) } for _ , feature := range features { var f Feature isEnabled := true s := strings . Split ( feature , " " ) f = Feature ( s [ 0 ] ) if len ( s ) == 2 { isEnabled = util . CheckTruthy ( s [ 1 ] ) } else if len ( s ) > 2 { return fmt . Errorf ( " " , feature ) } if ! containsFeature ( supportedFeatures , f ) { return fmt . Errorf ( " " , f ) } fg [ f ] = isEnabled } for k , v := range fg { klog . Infof ( " " , k , util . StateStatus ( v ) ) } return nil }
SetFeatureFlag parses a slice of string and sets the feature flag.
SetFeatureFlag parses a slice of string and sets the feature flag .
// iterate through each feature and set its state onto the featureFlag map // by default if a feature gate is provided, it is enabled // if the feature is specified in the format // MyFeature=false, the string need to be parsed and // corresponding state to be set on the feature // only if length after splitting =2, we need to check whether the // feature is enabled or disabled // if length > 2 , there is some error in the format specified // check if the feature flag provided is available in the list of // supported features