summaryrefslogtreecommitdiff
path: root/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-03-28 10:30:09 +0100
committerValentin Rothberg <rothberg@redhat.com>2019-03-28 15:12:26 +0100
commita5443a532b0fc6bd787cbb472c0ad2f75447c9df (patch)
tree691ecc024dfedff5695e426a8f3a6c077cfc34b8 /vendor/github.com/containernetworking/cni/pkg/version/plugin.go
parente7a2eecf5f3975edfb92cd2cacff0d34ef45f808 (diff)
downloadpodman-a5443a532b0fc6bd787cbb472c0ad2f75447c9df.tar.gz
podman-a5443a532b0fc6bd787cbb472c0ad2f75447c9df.tar.bz2
podman-a5443a532b0fc6bd787cbb472c0ad2f75447c9df.zip
vendor buildah, image, storage, cni
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/containernetworking/cni/pkg/version/plugin.go')
-rw-r--r--vendor/github.com/containernetworking/cni/pkg/version/plugin.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/vendor/github.com/containernetworking/cni/pkg/version/plugin.go b/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
index 612335a81..1df427243 100644
--- a/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
+++ b/vendor/github.com/containernetworking/cni/pkg/version/plugin.go
@@ -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)