]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: revert "remove unnecessary else conditions"
authorRuss Cox <rsc@golang.org>
Tue, 13 Nov 2018 15:15:02 +0000 (15:15 +0000)
committerRuss Cox <rsc@golang.org>
Tue, 13 Nov 2018 15:15:18 +0000 (15:15 +0000)
This reverts CL 144137.

Reason for revert: The justification for the original commit
was that golint said so, but golint is wrong. The code reads
more clearly the original way.

Change-Id: I960f286ed66fec67aabd953e7b69993f60b00bca
Reviewed-on: https://go-review.googlesource.com/c/149339
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/internal/semver/semver.go

index d61c6b476a6781ba5644df8e1f446c401892b121..4af7118e55d2ef7977266d9561027ca0f9935b02 100644 (file)
@@ -312,8 +312,9 @@ func compareInt(x, y string) int {
        }
        if x < y {
                return -1
+       } else {
+               return +1
        }
-       return +1
 }
 
 func comparePrerelease(x, y string) int {
@@ -352,8 +353,9 @@ func comparePrerelease(x, y string) int {
                        if ix != iy {
                                if ix {
                                        return -1
+                               } else {
+                                       return +1
                                }
-                               return +1
                        }
                        if ix {
                                if len(dx) < len(dy) {
@@ -365,14 +367,16 @@ func comparePrerelease(x, y string) int {
                        }
                        if dx < dy {
                                return -1
+                       } else {
+                               return +1
                        }
-                       return +1
                }
        }
        if x == "" {
                return -1
+       } else {
+               return +1
        }
-       return +1
 }
 
 func nextIdent(x string) (dx, rest string) {