Currently versionOK is repeated quite a bit. Reasons for that are
- There is difference between how to get the current version of a command.
- There is difference between how to get the required version, sometimes from dockerfile sometimes from a const.
- The constraintString is not always in the same format
constraintString cloud be abstracted with the this logic
func constraint(constraint string) string {
// digits should be <= 0. any is a string and can only be any
// in format of semver
if string matches "digit|any.digit|any.digit|any {
split on .
if a digit, this is the deviation from the req, any means any diviation
}
else {
version requirement is passed through. This is useful when having fixed version like terraform >1.3.6 and <1.6.0
}
}
With then we could make a generic versionOK that requires the current version, required version and version contstraint as input.
Currently versionOK is repeated quite a bit. Reasons for that are
constraintString cloud be abstracted with the this logic
With then we could make a generic versionOK that requires the current version, required version and version contstraint as input.