浏览代码

api/types/versions: simplify compare if versions are equal

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父节点
当前提交
96e4adfdc2
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      api/types/versions/compare.go

+ 3 - 0
api/types/versions/compare.go

@@ -8,6 +8,9 @@ import (
 // compare compares two version strings
 // returns -1 if v1 < v2, 1 if v1 > v2, 0 otherwise.
 func compare(v1, v2 string) int {
+	if v1 == v2 {
+		return 0
+	}
 	var (
 		currTab  = strings.Split(v1, ".")
 		otherTab = strings.Split(v2, ".")