Skip to content

Commit 8f7173d

Browse files
committed
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/149339 Reviewed-by: Russ Cox <[email protected]>
1 parent e51b19a commit 8f7173d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ func compareInt(x, y string) int {
312312
}
313313
if x < y {
314314
return -1
315+
} else {
316+
return +1
315317
}
316-
return +1
317318
}
318319

319320
func comparePrerelease(x, y string) int {
@@ -352,8 +353,9 @@ func comparePrerelease(x, y string) int {
352353
if ix != iy {
353354
if ix {
354355
return -1
356+
} else {
357+
return +1
355358
}
356-
return +1
357359
}
358360
if ix {
359361
if len(dx) < len(dy) {
@@ -365,14 +367,16 @@ func comparePrerelease(x, y string) int {
365367
}
366368
if dx < dy {
367369
return -1
370+
} else {
371+
return +1
368372
}
369-
return +1
370373
}
371374
}
372375
if x == "" {
373376
return -1
377+
} else {
378+
return +1
374379
}
375-
return +1
376380
}
377381

378382
func nextIdent(x string) (dx, rest string) {

0 commit comments

Comments
 (0)