]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove unnecessary else conditions
authordiplozoon <huyuumi.dev@gmail.com>
Tue, 23 Oct 2018 13:17:20 +0000 (13:17 +0000)
committerIan Lance Taylor <iant@golang.org>
Tue, 23 Oct 2018 14:44:06 +0000 (14:44 +0000)
Fixes golint warning about "if block ends with a return statement, so drop this else and outdent its block".

Change-Id: I6fc8724f586efcb6e2ed92ee36be421d3e9a8c80
Reviewed-on: https://go-review.googlesource.com/c/144137
Reviewed-by: Ralph Corderoy <ralph@inputplus.co.uk>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/internal/semver/semver.go

index 4af7118e55d2ef7977266d9561027ca0f9935b02..d61c6b476a6781ba5644df8e1f446c401892b121 100644 (file)
@@ -312,9 +312,8 @@ func compareInt(x, y string) int {
        }
        if x < y {
                return -1
-       } else {
-               return +1
        }
+       return +1
 }
 
 func comparePrerelease(x, y string) int {
@@ -353,9 +352,8 @@ 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) {
@@ -367,16 +365,14 @@ 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) {