plugin/discovery: provide an AllVersions set

Various implied dependencies will accept all versions, so this is
convenient for populating dependency data structures for such implied
dependencies.
This commit is contained in:
Martin Atkins 2017-04-20 18:13:54 -07:00
parent e89b5390ca
commit cfc08ae7e3
1 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,15 @@ type VersionSet struct {
raw version.Constraints
}
// AllVersions is a VersionSet containing all versions
var AllVersions VersionSet
func init() {
AllVersions = VersionSet{
raw: make(version.Constraints, 0),
}
}
// Has returns true if the given version is in the receiving set.
func (s VersionSet) Has(v Version) bool {
return s.raw.Check(v.raw)