isReplacementAvailableIn returns true if the replacement api is available in the applicable targetVersion Will return false if the targetVersion passed is not a valid semver string
(targetVersions map[string]string)
| 245 | // isReplacementAvailableIn returns true if the replacement api is available in the applicable targetVersion |
| 246 | // Will return false if the targetVersion passed is not a valid semver string |
| 247 | func (v *Version) isReplacementAvailableIn(targetVersions map[string]string) bool { |
| 248 | for component, targetVersion := range targetVersions { |
| 249 | if !semver.IsValid(targetVersion) { |
| 250 | klog.V(3).Infof("targetVersion %s for %s is not valid semVer", targetVersion, component) |
| 251 | return false |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | if v.ReplacementAvailableIn == "" { |
| 256 | return false |
| 257 | } |
| 258 | |
| 259 | targetVersion, ok := targetVersions[v.Component] |
| 260 | if !ok { |
| 261 | klog.V(3).Infof("targetVersion missing for component %s", v.Component) |
| 262 | return false |
| 263 | } |
| 264 | |
| 265 | comparison := semver.Compare(targetVersion, v.ReplacementAvailableIn) |
| 266 | return comparison >= 0 |
| 267 | } |
| 268 | |
| 269 | // PrintVersionList prints out the list of versions |
| 270 | // in a specific format |
no outgoing calls