Skip to content

Commit

Permalink
etcdctl/ctlv2/command: fix type switch case order
Browse files Browse the repository at this point in the history
Since syscall.Errno implements net.Error and all cases
are matched sequentially, it's a mistake to put syscall.Errno
case after net.Error since it will never be executed.

This change swaps syscall.Errno case with net.Error
to give that clause chance to execute.
  • Loading branch information
quasilyte committed Jul 28, 2018
1 parent 90a2fbe commit 3da90b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions etcdctl/ctlv2/command/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ func isConnectionError(err error) bool {
return true
}
return isConnectionError(t.Err)
case net.Error:
if t.Timeout() {
return true
}
case syscall.Errno:
if t == syscall.ECONNREFUSED {
return true
}
case net.Error:
if t.Timeout() {
return true
}
}
return false
}
Expand Down

0 comments on commit 3da90b6

Please sign in to comment.