func SeriesForCharm(requestedSeries string, supportedSeries []string) (string, error) {
	// Old charm with no supported series.
	if len(supportedSeries) == 0 {
		if requestedSeries == "" {
			return "", errMissingSeries
		}
		return requestedSeries, nil
	}
	// Use the charm default.
	if requestedSeries == "" {
		return supportedSeries[0], nil
	}
	for _, s := range supportedSeries {
		if s == requestedSeries {
			return requestedSeries, nil
		}
	}
	return "", &unsupportedSeriesError{requestedSeries, supportedSeries}
}
// SeriesForCharm takes a requested series and a list of series supported by a
// charm and returns the series which is relevant.
// If the requested series is empty, then the first supported series is used,
// otherwise the requested series is validated against the supported series.
SeriesForCharm takes a requested series and a list of series supported by a
charm and returns the series which is relevant.
If the requested series is empty, then the first supported series is used,
otherwise the requested series is validated against the supported series.
// SeriesForCharm takes a requested series and a list of series supported by a // charm and returns the series which is relevant . // If the requested series is empty then the first supported series is used // otherwise the requested series is validated against the supported series .
func SeriesForCharm(requestedSeries string, supportedSeries []string) (string, error) {
	if len(supportedSeries) == 0 {
		if requestedSeries == "" {
			return "", errMissingSeries
		}
		return requestedSeries, nil
	}
	if requestedSeries == "" {
		return supportedSeries[0], nil
	}
	for _, s := range supportedSeries {
		if s == requestedSeries {
			return requestedSeries, nil
		}
	}
	return "", &unsupportedSeriesError{requestedSeries, supportedSeries}
}
func SeriesForCharm ( requestedSeries string , supportedSeries [ ] string ) ( string , error ) { if len ( supportedSeries ) == 0 { if requestedSeries == " " { return " " , errMissingSeries } return requestedSeries , nil } if requestedSeries == " " { return supportedSeries [ 0 ] , nil } for _ , s := range supportedSeries { if s == requestedSeries { return requestedSeries , nil } } return " " , & unsupportedSeriesError { requestedSeries , supportedSeries } }
SeriesForCharm takes a requested series and a list of series supported by a
charm and returns the series which is relevant.
SeriesForCharm takes a requested series and a list of series supported by a charm and returns the series which is relevant .
// Old charm with no supported series. // Use the charm default.