Skip to content

Commit

Permalink
Merge pull request #691 from srl-labs/deepsource-fix-4c96e468
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 7ca1585 + 34deb9f commit dbb0bb3
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion clab/config/transport/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (t *SSHTransport) Write(data, info *string) error {

// Connect to a host
// Part of the Transport interface
func (t *SSHTransport) Connect(host string, options ...TransportOption) error {
func (t *SSHTransport) Connect(host string, _ ...TransportOption) error {
// Assign Default Values
if t.PromptChar == "" {
t.PromptChar = "#"
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func init() {
rootCmd.PersistentFlags().StringVarP(&rt, "runtime", "r", "", "container runtime")
}

func sudoCheck(cmd *cobra.Command, args []string) error {
func sudoCheck(_ *cobra.Command, _ []string) error {
id := os.Geteuid()
if id != 0 {
return errors.New("containerlab requires sudo privileges to run")
Expand Down
4 changes: 2 additions & 2 deletions nodes/crpd/crpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *crpd) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
}
func (s *crpd) Config() *types.NodeConfig { return s.cfg }

func (s *crpd) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *crpd) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return createCRPDFiles(s.cfg)
}
Expand All @@ -69,7 +69,7 @@ func (s *crpd) Deploy(ctx context.Context) error {
return err
}

func (s *crpd) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
func (s *crpd) PostDeploy(ctx context.Context, _ map[string]nodes.Node) error {
log.Debugf("Running postdeploy actions for CRPD %q node", s.cfg.ShortName)
_, stderr, err := s.runtime.Exec(ctx, s.cfg.ContainerID, []string{"service", "ssh", "restart"})
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions nodes/mysocketio/mysocketio.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (s *mySocketIO) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error

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

func (s *mySocketIO) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *mySocketIO) PreDeploy(_, _, _ string) error {

return nil
}
Expand All @@ -56,7 +56,7 @@ func (s *mySocketIO) WithMgmtNet(*types.MgmtNet) {}
func (s *mySocketIO) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *mySocketIO) GetRuntime() runtime.ContainerRuntime { return s.runtime }

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

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

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

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

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

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

func (s *vrCsr) SaveConfig(ctx context.Context) error {
func (s *vrCsr) SaveConfig(_ context.Context) error {
err := utils.SaveCfgViaNetconf(s.cfg.LongName,
nodes.DefaultCredentials[s.cfg.Kind][0],
nodes.DefaultCredentials[s.cfg.Kind][1],
Expand Down
6 changes: 3 additions & 3 deletions nodes/vr_sros/vr-sros.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *vrSROS) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

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

func (s *vrSROS) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *vrSROS) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return createVrSROSFiles(s.cfg)
}
Expand All @@ -81,7 +81,7 @@ func (s *vrSROS) Deploy(ctx context.Context) error {
return err
}

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

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

func (s *vrSROS) SaveConfig(ctx context.Context) error {
func (s *vrSROS) SaveConfig(_ context.Context) error {
err := utils.SaveCfgViaNetconf(s.cfg.LongName,
nodes.DefaultCredentials[s.cfg.Kind][0],
nodes.DefaultCredentials[s.cfg.Kind][1],
Expand Down
6 changes: 3 additions & 3 deletions nodes/vr_veos/vr-veos.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ func (s *vrVEOS) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

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

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

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

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

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

func (s *vrVEOS) SaveConfig(ctx context.Context) error {
func (s *vrVEOS) SaveConfig(_ context.Context) error {
err := utils.SaveCfgViaNetconf(s.cfg.LongName,
nodes.DefaultCredentials[s.cfg.Kind][0],
nodes.DefaultCredentials[s.cfg.Kind][1],
Expand Down
6 changes: 3 additions & 3 deletions nodes/vr_vmx/vr-vmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *vrVMX) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

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

func (s *vrVMX) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *vrVMX) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return nil
}
Expand All @@ -69,7 +69,7 @@ func (s *vrVMX) Deploy(ctx context.Context) error {
return err
}

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

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

func (s *vrVMX) SaveConfig(ctx context.Context) error {
func (s *vrVMX) SaveConfig(_ context.Context) error {
err := utils.SaveCfgViaNetconf(s.cfg.LongName,
nodes.DefaultCredentials[s.cfg.Kind][0],
nodes.DefaultCredentials[s.cfg.Kind][1],
Expand Down
6 changes: 3 additions & 3 deletions nodes/vr_xrv/vr-xrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (s *vrXRV) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
}
func (s *vrXRV) Config() *types.NodeConfig { return s.cfg }

func (s *vrXRV) PreDeploy(configName, labCADir, labCARoot string) error {
func (s *vrXRV) PreDeploy(_, _, _ string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return nil
}
Expand All @@ -68,7 +68,7 @@ func (s *vrXRV) Deploy(ctx context.Context) error {
return err
}

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

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

func (s *vrXRV) SaveConfig(ctx context.Context) error {
func (s *vrXRV) SaveConfig(_ context.Context) error {
err := utils.SaveCfgViaNetconf(s.cfg.LongName,
nodes.DefaultCredentials[s.cfg.Kind][0],
nodes.DefaultCredentials[s.cfg.Kind][1],
Expand Down
6 changes: 3 additions & 3 deletions nodes/vr_xrv9k/vr-xrv9k.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *vrXRV9K) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {

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

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

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

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

func (s *vrXRV9K) SaveConfig(ctx context.Context) error {
func (s *vrXRV9K) SaveConfig(_ context.Context) error {
err := utils.SaveCfgViaNetconf(s.cfg.LongName,
nodes.DefaultCredentials[s.cfg.Kind][0],
nodes.DefaultCredentials[s.cfg.Kind][1],
Expand Down

0 comments on commit dbb0bb3

Please sign in to comment.