Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit aa6db6c

Browse files
committed
reuse dummy variable
1 parent 472b7b1 commit aa6db6c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/bridge.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,13 @@ func (b bridgeImpl) initPrep(config *BridgeConfig) error {
328328
// fails. Bridges take the lowest MTU of their interfaces. So
329329
// instead we create a temporary interface with the desired MTU,
330330
// attach that to the bridge, and then remove it again.
331-
dummy := &netlink.Dummy{LinkAttrs: netlink.NewLinkAttrs()}
332-
dummy.LinkAttrs.Name = WeaveDummyIfName
331+
var dummy netlink.Link
332+
dummy = &netlink.Dummy{LinkAttrs: netlink.NewLinkAttrs()}
333+
dummy.Attrs().Name = WeaveDummyIfName
333334
if err = LinkAddIfNotExist(dummy); err != nil {
334335
return errors.Wrap(err, "creating dummy interface")
335336
}
336337
defer func() {
337-
var dummy netlink.Link
338338
dummy, err = netlink.LinkByName(WeaveDummyIfName)
339339
if err == nil {
340340
if err = netlink.LinkDel(dummy); err != nil {

0 commit comments

Comments
 (0)