github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/modinstaller/helpers.go (about)

     1  package modinstaller
     2  
     3  import (
     4  	"github.com/Masterminds/semver/v3"
     5  	"github.com/turbot/steampipe/pkg/versionhelpers"
     6  )
     7  
     8  func getVersionSatisfyingConstraint(constraint *versionhelpers.Constraints, availableVersions []*semver.Version) *semver.Version {
     9  	// search the reverse sorted versions, finding the highest version which satisfies ALL constraints
    10  	for _, version := range availableVersions {
    11  		if constraint.Check(version) {
    12  			return version
    13  		}
    14  	}
    15  	return nil
    16  }