From 3da90b6d3e7a5e60bbbc1c3c387c760f7b1a23ce Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Sat, 28 Jul 2018 23:33:13 +0300 Subject: [PATCH] etcdctl/ctlv2/command: fix type switch case order 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. --- etcdctl/ctlv2/command/util.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etcdctl/ctlv2/command/util.go b/etcdctl/ctlv2/command/util.go index 7cbc0de2c..133b4000e 100644 --- a/etcdctl/ctlv2/command/util.go +++ b/etcdctl/ctlv2/command/util.go @@ -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 }