Commit 8f7173dc authored by Russ Cox's avatar Russ Cox

cmd/go: revert "remove unnecessary else conditions"

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/149339Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent e51b19a9
...@@ -312,8 +312,9 @@ func compareInt(x, y string) int { ...@@ -312,8 +312,9 @@ func compareInt(x, y string) int {
} }
if x < y { if x < y {
return -1 return -1
} } else {
return +1 return +1
}
} }
func comparePrerelease(x, y string) int { func comparePrerelease(x, y string) int {
...@@ -352,9 +353,10 @@ func comparePrerelease(x, y string) int { ...@@ -352,9 +353,10 @@ func comparePrerelease(x, y string) int {
if ix != iy { if ix != iy {
if ix { if ix {
return -1 return -1
} } else {
return +1 return +1
} }
}
if ix { if ix {
if len(dx) < len(dy) { if len(dx) < len(dy) {
return -1 return -1
...@@ -365,14 +367,16 @@ func comparePrerelease(x, y string) int { ...@@ -365,14 +367,16 @@ func comparePrerelease(x, y string) int {
} }
if dx < dy { if dx < dy {
return -1 return -1
} } else {
return +1 return +1
} }
} }
}
if x == "" { if x == "" {
return -1 return -1
} } else {
return +1 return +1
}
} }
func nextIdent(x string) (dx, rest string) { func nextIdent(x string) (dx, rest string) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment