func (c *Cookbook) badConstraints(constraints versionConstraint) []string { bad := make([]string, 0, len(constraints)) if constraints == nil { return bad } cbversions := c.sortedVersions() for _, cs := range constraints { for _, cver := range cbversions { v, _ := gversion.NewVersion(cver.Version) if !cs.Check(v) { bad = append(bad, cs.String()) break } } } return bad }
func (c *Cookbook) latestMultiConstraint(constraints versionConstraint) *CookbookVersion { var cbv *CookbookVersion if constraints == nil { cbv = c.LatestVersion() } else { cbversions := c.sortedVersions() Ver: for _, cver := range cbversions { v, _ := gversion.NewVersion(cver.Version) for _, cs := range constraints { if !cs.Check(v) { continue Ver } cbv = cver break Ver } } } return cbv }