Skip to content

Commit

Permalink
Merge pull request #692 from srl-labs/deepsource-fix-d6aecde9
Browse files Browse the repository at this point in the history
Unused parameter should be replaced by underscore
  • Loading branch information
hellt committed Nov 22, 2021
2 parents dbb0bb3 + 1c2bc27 commit b09bc5e
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion clab/config/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/srl-labs/containerlab/nodes"
)

func Send(cs *NodeConfig, action string) error {
func Send(cs *NodeConfig, _ string) error {
var tx transport.Transport
var err error

Expand Down
2 changes: 1 addition & 1 deletion clab/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
var g *gographviz.Graph

// GenerateGraph generates a graph of the lab topology
func (c *CLab) GenerateGraph(topo string) error {
func (c *CLab) GenerateGraph(_ string) error {
log.Info("Generating lab graph...")
g = gographviz.NewGraph()
if err := g.SetName(c.TopoFile.name); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var signCertCmd = &cobra.Command{
RunE: signCert,
}

func createCA(cmd *cobra.Command, args []string) error {
func createCA(_ *cobra.Command, _ []string) error {
csr := `{
"CN": "{{.CommonName}}",
"key": {
Expand Down Expand Up @@ -147,7 +147,7 @@ func createCA(cmd *cobra.Command, args []string) error {
}

// create node certificate and sign it with CA
func signCert(cmd *cobra.Command, args []string) error {
func signCert(_ *cobra.Command, _ []string) error {
csr := `{
"CN": "{{.CommonName}}",
"hosts": [
Expand Down
14 changes: 7 additions & 7 deletions nodes/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ func (s *bridge) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
s.cfg.DeploymentStatus = "created" // since we do not create bridges with clab, the status is implied here
return nil
}
func (s *bridge) Config() *types.NodeConfig { return s.cfg }
func (s *bridge) PreDeploy(configName, labCADir, labCARoot string) error { return nil }
func (s *bridge) Deploy(ctx context.Context) error { return nil }
func (s *bridge) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *bridge) Config() *types.NodeConfig { return s.cfg }
func (s *bridge) PreDeploy(_, _, _ string) error { return nil }
func (s *bridge) Deploy(_ context.Context) error { return nil }
func (s *bridge) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
return nil
}
func (s *bridge) WithMgmtNet(*types.MgmtNet) {}
func (s *bridge) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *bridge) GetRuntime() runtime.ContainerRuntime { return s.runtime }

func (s *bridge) GetContainer(ctx context.Context) (*types.GenericContainer, error) {
func (s *bridge) GetContainer(_ context.Context) (*types.GenericContainer, error) {
return nil, nil
}

func (s *bridge) SaveConfig(ctx context.Context) error { return nil }
func (s *bridge) SaveConfig(_ context.Context) error { return nil }

func (s *bridge) GetImages() map[string]string { return map[string]string{} }

func (s *bridge) Delete(ctx context.Context) error {
func (s *bridge) Delete(_ context.Context) error {
return nil
}
6 changes: 3 additions & 3 deletions nodes/cvx/cvx.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *cvx) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

func (c *cvx) Config() *types.NodeConfig { return c.cfg }

func (c *cvx) PreDeploy(configName, labCADir, labCARoot string) error { return nil }
func (c *cvx) PreDeploy(_, _, _ string) error { return nil }

func (c *cvx) Deploy(ctx context.Context) error {

Expand All @@ -85,7 +85,7 @@ func (c *cvx) Deploy(ctx context.Context) error {
return nil
}

func (c *cvx) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (c *cvx) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
log.Debugf("Running postdeploy actions for cvx '%s' node", c.cfg.ShortName)
if c.vmChans == nil {
return nil
Expand Down Expand Up @@ -116,7 +116,7 @@ func (c *cvx) Delete(ctx context.Context) error {

func (s *cvx) GetRuntime() runtime.ContainerRuntime { return s.runtime }

func (c *cvx) SaveConfig(ctx context.Context) error {
func (c *cvx) SaveConfig(_ context.Context) error {
log.Debugf("Save operation is currently not supported for %q node kind", c.cfg.Kind)
return nil
}
12 changes: 6 additions & 6 deletions nodes/host/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func (s *host) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
return nil
}
func (s *host) Config() *types.NodeConfig { return s.cfg }
func (s *host) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *host) PreDeploy(_, _, _ string) error {
return nil
}
func (s *host) Deploy(ctx context.Context) error { return nil }
func (s *host) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *host) Deploy(_ context.Context) error { return nil }
func (s *host) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
return nil
}

Expand All @@ -46,14 +46,14 @@ func (s *host) WithMgmtNet(*types.MgmtNet) {}
func (s *host) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *host) GetRuntime() runtime.ContainerRuntime { return s.runtime }

func (s *host) GetContainer(ctx context.Context) (*types.GenericContainer, error) {
func (s *host) GetContainer(_ context.Context) (*types.GenericContainer, error) {
return nil, nil
}

func (s *host) Delete(ctx context.Context) error {
func (s *host) Delete(_ context.Context) error {
return nil
}

func (s *host) SaveConfig(ctx context.Context) error {
func (s *host) SaveConfig(_ context.Context) error {
return nil
}
6 changes: 3 additions & 3 deletions nodes/linux/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ func (l *linux) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

func (l *linux) Config() *types.NodeConfig { return l.cfg }

func (l *linux) PreDeploy(configName, labCADir, labCARoot string) error { return nil }
func (l *linux) PreDeploy(_, _, _ string) error { return nil }

func (l *linux) Deploy(ctx context.Context) error {
_, err := l.runtime.CreateContainer(ctx, l.cfg)
return err
}

func (l *linux) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (l *linux) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
log.Debugf("Running postdeploy actions for Linux '%s' node", l.cfg.ShortName)
return types.DisableTxOffload(l.cfg)
}
Expand All @@ -67,6 +67,6 @@ func (l *linux) Delete(ctx context.Context) error {
return l.runtime.DeleteContainer(ctx, l.Config().LongName)
}

func (s *linux) SaveConfig(ctx context.Context) error {
func (s *linux) SaveConfig(_ context.Context) error {
return nil
}
12 changes: 6 additions & 6 deletions nodes/ovs/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@ func (l *ovs) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

func (l *ovs) Config() *types.NodeConfig { return l.cfg }

func (l *ovs) PreDeploy(configName, labCADir, labCARoot string) error { return nil }
func (l *ovs) PreDeploy(_, _, _ string) error { return nil }

func (l *ovs) Deploy(ctx context.Context) error { return nil }
func (l *ovs) Deploy(_ context.Context) error { return nil }

func (l *ovs) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (l *ovs) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
return nil
}

func (l *ovs) WithMgmtNet(*types.MgmtNet) {}
func (s *ovs) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *ovs) GetRuntime() runtime.ContainerRuntime { return s.runtime }

func (s *ovs) GetContainer(ctx context.Context) (*types.GenericContainer, error) {
func (s *ovs) GetContainer(_ context.Context) (*types.GenericContainer, error) {
return nil, nil
}

func (s *ovs) Delete(ctx context.Context) error {
func (s *ovs) Delete(_ context.Context) error {
return nil
}

func (s *ovs) GetImages() map[string]string { return map[string]string{} }

func (s *ovs) SaveConfig(ctx context.Context) error {
func (s *ovs) SaveConfig(_ context.Context) error {
return nil
}
6 changes: 3 additions & 3 deletions nodes/sonic/sonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *sonic) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
}
func (s *sonic) Config() *types.NodeConfig { return s.cfg }

func (s *sonic) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *sonic) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)

return nil
Expand All @@ -48,7 +48,7 @@ func (s *sonic) Deploy(ctx context.Context) error {
return err
}

func (s *sonic) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *sonic) PostDeploy(ctx context.Context, _ map[string]nodes.Node) error {
log.Debugf("Running postdeploy actions for sonic-vs '%s' node", s.cfg.ShortName)

err := s.runtime.ExecNotWait(ctx, s.cfg.ContainerID, []string{"supervisord"})
Expand Down Expand Up @@ -78,6 +78,6 @@ func (s *sonic) GetImages() map[string]string {
}
}

func (s *sonic) SaveConfig(ctx context.Context) error {
func (s *sonic) SaveConfig(_ context.Context) error {
return nil
}
8 changes: 4 additions & 4 deletions nodes/vr_n9kv/vr-n9kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ func (s *vrN9kv) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
return nil
}
func (s *vrN9kv) Config() *types.NodeConfig { return s.cfg }
func (s *vrN9kv) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *vrN9kv) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return nil
}
func (s *vrN9kv) Deploy(ctx context.Context) error {
_, err := s.runtime.CreateContainer(ctx, s.cfg)
return err
}
func (s *vrN9kv) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *vrN9kv) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
return nil
}

Expand All @@ -69,7 +69,7 @@ func (s *vrN9kv) GetImages() map[string]string {
}
}

func (s *vrN9kv) Destroy(ctx context.Context) error { return nil }
func (s *vrN9kv) Destroy(_ context.Context) error { return nil }
func (s *vrN9kv) WithMgmtNet(mgmt *types.MgmtNet) { s.mgmt = mgmt }
func (s *vrN9kv) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *vrN9kv) GetRuntime() runtime.ContainerRuntime { return s.runtime }
Expand All @@ -78,6 +78,6 @@ func (s *vrN9kv) Delete(ctx context.Context) error {
return s.runtime.DeleteContainer(ctx, s.Config().LongName)
}

func (s *vrN9kv) SaveConfig(ctx context.Context) error {
func (s *vrN9kv) SaveConfig(_ context.Context) error {
return nil
}
6 changes: 3 additions & 3 deletions nodes/vr_nxos/vr-nxos.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (s *vrNXOS) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

func (s *vrNXOS) Config() *types.NodeConfig { return s.cfg }

func (s *vrNXOS) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *vrNXOS) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return nil
}
Expand All @@ -67,7 +67,7 @@ func (s *vrNXOS) GetImages() map[string]string {
}
}

func (s *vrNXOS) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *vrNXOS) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
return nil
}

Expand All @@ -81,6 +81,6 @@ func (s *vrNXOS) Delete(ctx context.Context) error {
return s.runtime.DeleteContainer(ctx, s.Config().LongName)
}

func (s *vrNXOS) SaveConfig(ctx context.Context) error {
func (s *vrNXOS) SaveConfig(_ context.Context) error {
return nil
}
8 changes: 4 additions & 4 deletions nodes/vr_pan/vr-pan.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ func (s *vrPan) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
return nil
}
func (s *vrPan) Config() *types.NodeConfig { return s.cfg }
func (s *vrPan) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *vrPan) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return nil
}
func (s *vrPan) Deploy(ctx context.Context) error {
_, err := s.runtime.CreateContainer(ctx, s.cfg)
return err
}
func (s *vrPan) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *vrPan) PostDeploy(_ context.Context, _ map[string]nodes.Node) error {
return nil
}

Expand All @@ -71,7 +71,7 @@ func (s *vrPan) GetImages() map[string]string {
}
}

func (s *vrPan) Destroy(ctx context.Context) error { return nil }
func (s *vrPan) Destroy(_ context.Context) error { return nil }
func (s *vrPan) WithMgmtNet(mgmt *types.MgmtNet) { s.mgmt = mgmt }
func (s *vrPan) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *vrPan) GetRuntime() runtime.ContainerRuntime { return s.runtime }
Expand All @@ -80,6 +80,6 @@ func (s *vrPan) Delete(ctx context.Context) error {
return s.runtime.DeleteContainer(ctx, s.Config().LongName)
}

func (s *vrPan) SaveConfig(ctx context.Context) error {
func (s *vrPan) SaveConfig(_ context.Context) error {
return nil
}
2 changes: 1 addition & 1 deletion runtime/containerd/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (c *ContainerdRuntime) WithKeepMgmtNet() {
func (c *ContainerdRuntime) GetName() string { return runtimeName }
func (c *ContainerdRuntime) Config() runtime.RuntimeConfig { return c.config }

func (c *ContainerdRuntime) CreateNet(ctx context.Context) error {
func (c *ContainerdRuntime) CreateNet(_ context.Context) error {
log.Debug("CreateNet() - Not needed with containerd")
return nil
}
Expand Down

0 comments on commit b09bc5e

Please sign in to comment.