mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-20 19:00:11 -05:00
17 lines
468 B
Go
17 lines
468 B
Go
package modinstaller
|
|
|
|
import (
|
|
"github.com/Masterminds/semver/v3"
|
|
"github.com/turbot/steampipe/pkg/versionhelpers"
|
|
)
|
|
|
|
func getVersionSatisfyingConstraint(constraint *versionhelpers.Constraints, availableVersions []*semver.Version) *semver.Version {
|
|
// search the reverse sorted versions, finding the highest version which satisfies ALL constraints
|
|
for _, version := range availableVersions {
|
|
if constraint.Check(version) {
|
|
return version
|
|
}
|
|
}
|
|
return nil
|
|
}
|