From aa6db6c8947dbd5e73be0c7e100405264f4f3187 Mon Sep 17 00:00:00 2001 From: Murali Reddy Date: Tue, 22 Jan 2019 18:42:43 +0530 Subject: [PATCH] reuse dummy variable --- net/bridge.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/bridge.go b/net/bridge.go index f3ee7032e2..8b9a93ec2e 100644 --- a/net/bridge.go +++ b/net/bridge.go @@ -328,13 +328,13 @@ func (b bridgeImpl) initPrep(config *BridgeConfig) error { // fails. Bridges take the lowest MTU of their interfaces. So // instead we create a temporary interface with the desired MTU, // attach that to the bridge, and then remove it again. - dummy := &netlink.Dummy{LinkAttrs: netlink.NewLinkAttrs()} - dummy.LinkAttrs.Name = WeaveDummyIfName + var dummy netlink.Link + dummy = &netlink.Dummy{LinkAttrs: netlink.NewLinkAttrs()} + dummy.Attrs().Name = WeaveDummyIfName if err = LinkAddIfNotExist(dummy); err != nil { return errors.Wrap(err, "creating dummy interface") } defer func() { - var dummy netlink.Link dummy, err = netlink.LinkByName(WeaveDummyIfName) if err == nil { if err = netlink.LinkDel(dummy); err != nil {