github.com/safedep/dry@v0.0.0-20241016050132-a15651f0548b/semver/utils.go (about) 1 package semver 2 3 import ( 4 mver "github.com/Masterminds/semver/v3" 5 ) 6 7 func IsSemver(s string) bool { 8 _, err := mver.NewVersion(s) 9 return err == nil 10 } 11 12 func IsVersionInRange(v, r string) bool { 13 v1, err := mver.NewVersion(v) 14 if err != nil { 15 return false 16 } 17 18 r1, err := mver.NewConstraint(r) 19 if err != nil { 20 return false 21 } 22 23 return r1.Check(v1) 24 }