mirror of
https://github.com/rancher/plugins.git
synced 2025-09-20 10:10:11 +00:00
vendor: bump libcni to v0.7.0-rc2
This commit is contained in:
10
vendor/github.com/containernetworking/cni/pkg/version/plugin.go
generated
vendored
10
vendor/github.com/containernetworking/cni/pkg/version/plugin.go
generated
vendored
@@ -86,9 +86,13 @@ func (*PluginDecoder) Decode(jsonBytes []byte) (PluginInfo, error) {
|
||||
// minor, and micro numbers or returns an error
|
||||
func ParseVersion(version string) (int, int, int, error) {
|
||||
var major, minor, micro int
|
||||
if version == "" {
|
||||
return -1, -1, -1, fmt.Errorf("invalid version %q: the version is empty", version)
|
||||
}
|
||||
|
||||
parts := strings.Split(version, ".")
|
||||
if len(parts) == 0 || len(parts) >= 4 {
|
||||
return -1, -1, -1, fmt.Errorf("invalid version %q: too many or too few parts", version)
|
||||
if len(parts) >= 4 {
|
||||
return -1, -1, -1, fmt.Errorf("invalid version %q: too many parts", version)
|
||||
}
|
||||
|
||||
major, err := strconv.Atoi(parts[0])
|
||||
@@ -114,7 +118,7 @@ func ParseVersion(version string) (int, int, int, error) {
|
||||
}
|
||||
|
||||
// GreaterThanOrEqualTo takes two string versions, parses them into major/minor/micro
|
||||
// nubmers, and compares them to determine whether the first version is greater
|
||||
// numbers, and compares them to determine whether the first version is greater
|
||||
// than or equal to the second
|
||||
func GreaterThanOrEqualTo(version, otherVersion string) (bool, error) {
|
||||
firstMajor, firstMinor, firstMicro, err := ParseVersion(version)
|
||||
|
Reference in New Issue
Block a user