func MetaFormatReasons(ch CharmMeta) (Format, []FormatSelectionReason) {
	manifest := ch.Manifest()

	// To better inform users of why a metadata selection was preferred over
	// another, we deduce why a format is selected over another.
	reasons := set.NewStrings()
	if manifest != nil {
		reasons.Add(SelectionManifest)
		if len(manifest.Bases) > 0 {
			reasons.Add(SelectionBases)
		}
	}
	if len(ch.Meta().Series) > 0 {
		reasons.Add(SelectionSeries)
	}

	// To be a format v1 you can have no series with no bases or containers, or
	// just have a series slice.
	format := FormatV1
	if !reasons.Contains(SelectionSeries) && reasons.Intersection(formatV2Set).Size() > 0 {
		format = FormatV2
	}

	return format, reasons.SortedValues()
}
// MetaFormatReasons returns the format and why the selection was done. We can
// then inspect the reasons to understand the reasoning.
MetaFormatReasons returns the format and why the selection was done. We can
then inspect the reasons to understand the reasoning.
// MetaFormatReasons returns the format and why the selection was done . We can // then inspect the reasons to understand the reasoning .
func MetaFormatReasons(ch CharmMeta) (Format, []FormatSelectionReason) {
	manifest := ch.Manifest()
	reasons := set.NewStrings()
	if manifest != nil {
		reasons.Add(SelectionManifest)
		if len(manifest.Bases) > 0 {
			reasons.Add(SelectionBases)
		}
	}
	if len(ch.Meta().Series) > 0 {
		reasons.Add(SelectionSeries)
	}
	format := FormatV1
	if !reasons.Contains(SelectionSeries) && reasons.Intersection(formatV2Set).Size() > 0 {
		format = FormatV2
	}
	return format, reasons.SortedValues()
}
func MetaFormatReasons ( ch CharmMeta ) ( Format , [ ] FormatSelectionReason ) { manifest := ch . Manifest ( ) reasons := set . NewStrings ( ) if manifest != nil { reasons . Add ( SelectionManifest ) if len ( manifest . Bases ) > 0 { reasons . Add ( SelectionBases ) } } if len ( ch . Meta ( ) . Series ) > 0 { reasons . Add ( SelectionSeries ) } format := FormatV1 if ! reasons . Contains ( SelectionSeries ) && reasons . Intersection ( formatV2Set ) . Size ( ) > 0 { format = FormatV2 } return format , reasons . SortedValues ( ) }
MetaFormatReasons returns the format and why the selection was done.
MetaFormatReasons returns the format and why the selection was done .
// To better inform users of why a metadata selection was preferred over // another, we deduce why a format is selected over another. // To be a format v1 you can have no series with no bases or containers, or // just have a series slice.