2022-04-03 04:07:16 +00:00
|
|
|
package sprig
|
|
|
|
|
|
|
|
import (
|
2022-12-18 17:14:23 +00:00
|
|
|
sv2 "github.com/Masterminds/semver/v3"
|
2022-04-03 04:07:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func semverCompare(constraint, version string) (bool, error) {
|
|
|
|
c, err := sv2.NewConstraint(constraint)
|
|
|
|
if err != nil {
|
|
|
|
return false, err
|
|
|
|
}
|
|
|
|
|
|
|
|
v, err := sv2.NewVersion(version)
|
|
|
|
if err != nil {
|
|
|
|
return false, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.Check(v), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func semver(version string) (*sv2.Version, error) {
|
|
|
|
return sv2.NewVersion(version)
|
|
|
|
}
|