From a0e68a40c4ab7f2f1ab772eb03b5fd11bee5e965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Mon, 23 Oct 2023 14:19:35 +0800 Subject: [PATCH] fix golang lint error (#3323) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张祖建 --- pkg/daemon/ovs_linux.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/daemon/ovs_linux.go b/pkg/daemon/ovs_linux.go index c300dfed022..c833b8670fd 100644 --- a/pkg/daemon/ovs_linux.go +++ b/pkg/daemon/ovs_linux.go @@ -1169,12 +1169,11 @@ func getShortSharedDir(uid types.UID, volumeName string) string { } func linkExists(name string) (bool, error) { - _, err := netlink.LinkByName(name) - if err == nil { - return true, nil - } else if _, ok := err.(netlink.LinkNotFoundError); ok { - return false, nil - } else { + if _, err := netlink.LinkByName(name); err != nil { + if _, ok := err.(netlink.LinkNotFoundError); ok { + return false, nil + } return false, err } + return true, nil }