Skip to content

Commit

Permalink
fix white space issues
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Zappa <[email protected]>
  • Loading branch information
MikeZappa87 committed Aug 6, 2023
1 parent e4fd289 commit 1d661df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,20 @@ func (c *libcni) SetupSerially(ctx context.Context, id string, path string, opts
return c.createResult(result)
}

// BuildMultiNetwork build dynamic list of Networks.
// BuildMultiNetwork build dynamic list of Networks.
func (c *libcni) BuildMultiNetwork(networkNames []*NetworkInterface) ([]*Network, error) {
var network []*Network
ifaceindex := 0

config := make(map[string]*Network)
ifs := make(map[string]*Network)

for _, v := range c.Networks(){
for _, v := range c.Networks() {
config[v.config.Name] = v
}

name := ""
for _,v := range networkNames {
for _, v := range networkNames {
if net, ok := config[v.NetworkName]; ok {
if v.InterfaceName == "" {
name = getIfName(c.prefix, ifaceindex)
Expand All @@ -217,14 +217,14 @@ func (c *libcni) BuildMultiNetwork(networkNames []*NetworkInterface) ([]*Network
}

network = append(network, &Network{
cni: net.cni,
cni: net.cni,
config: net.config,
ifName: name,
})

if _, ok := ifs[name]; ok {
return nil, fmt.Errorf("the interface: %v already exists and must be unique", name)
}
}

ifs[name] = net
} else {
Expand Down
4 changes: 2 additions & 2 deletions cni_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func TestBuildNetworksWithAnnotation(t *testing.T) {
InterfaceName: "net1",
},
{
NetworkName: "plugin2",
NetworkName: "plugin2",
InterfaceName: "net10",
},
}
Expand Down Expand Up @@ -371,7 +371,7 @@ func TestBuildNetworksDuplicateIfName(t *testing.T) {
//InterfaceName: "This should be commented out"
},
{
NetworkName: "plugin2",
NetworkName: "plugin2",
InterfaceName: "net10",
},
}
Expand Down

0 comments on commit 1d661df

Please sign in to comment.