Skip to content

Commit

Permalink
chore: enable unused-parameter from revive
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Jan 17, 2025
1 parent 5b1738a commit 79d8659
Show file tree
Hide file tree
Showing 72 changed files with 217 additions and 218 deletions.
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ linters-settings:
- name: unreachable-code
disabled: false
- name: unused-parameter
disabled: true
- name: use-any
disabled: true
- name: var-declaration
Expand Down
12 changes: 6 additions & 6 deletions internal/hook/item_hook_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,12 @@ func (h *DefaultItemHookHandler) HandleHooks(
type NoOpItemHookHandler struct{}

func (h *NoOpItemHookHandler) HandleHooks(
log logrus.FieldLogger,
groupResource schema.GroupResource,
obj runtime.Unstructured,
resourceHooks []ResourceHook,
phase HookPhase,
hookTracker *HookTracker,
_ logrus.FieldLogger,
_ schema.GroupResource,
_ runtime.Unstructured,
_ []ResourceHook,
_ HookPhase,
_ *HookTracker,
) error {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/hook/wait_exec_hook_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (e *DefaultWaitExecHookHandler) HandleHooks(
UpdateFunc: func(_, newObj interface{}) {
handler(newObj)
},
DeleteFunc: func(obj interface{}) {
DeleteFunc: func(_ interface{}) {

Check warning on line 223 in internal/hook/wait_exec_hook_handler.go

View check run for this annotation

Codecov / codecov/patch

internal/hook/wait_exec_hook_handler.go#L223

Added line #L223 was not covered by tests
err := fmt.Errorf("pod %s deleted before all hooks were executed", kube.NamespaceAndName(pod))
log.Error(err)
cancel()
Expand Down
2 changes: 1 addition & 1 deletion internal/hook/wait_exec_hook_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type fakeListWatchFactory struct {
lw cache.ListerWatcher
}

func (f *fakeListWatchFactory) NewListWatch(ns string, selector fields.Selector) cache.ListerWatcher {
func (f *fakeListWatchFactory) NewListWatch(_ string, selector fields.Selector) cache.ListerWatcher {
return f.lw
}

Expand Down
2 changes: 1 addition & 1 deletion internal/storage/storagelocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func ListBackupStorageLocations(ctx context.Context, kbClient client.Client, nam
return locations, nil
}

func GetDefaultBackupStorageLocations(ctx context.Context, kbClient client.Client, namespace string) (*velerov1api.BackupStorageLocationList, error) {
func GetDefaultBackupStorageLocations(_ context.Context, kbClient client.Client, namespace string) (*velerov1api.BackupStorageLocationList, error) {

Check warning on line 97 in internal/storage/storagelocation.go

View check run for this annotation

Codecov / codecov/patch

internal/storage/storagelocation.go#L97

Added line #L97 was not covered by tests
locations := new(velerov1api.BackupStorageLocationList)
defaultLocations := new(velerov1api.BackupStorageLocationList)
if err := kbClient.List(context.Background(), locations, &client.ListOptions{Namespace: namespace}); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/backup/actions/backup_pv_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (a *PVCAction) AppliesTo() (velero.ResourceSelector, error) {

// Execute finds the PersistentVolume bound by the provided
// PersistentVolumeClaim, if any, and backs it up
func (a *PVCAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
func (a *PVCAction) Execute(item runtime.Unstructured, _ *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
a.log.Info("Executing PVCAction")

pvc := new(corev1api.PersistentVolumeClaim)
Expand Down
2 changes: 1 addition & 1 deletion pkg/backup/actions/pod_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (a *PodAction) AppliesTo() (velero.ResourceSelector, error) {
// Execute scans the pod's spec.volumes for persistentVolumeClaim volumes and returns a
// ResourceIdentifier list containing references to all of the persistentVolumeClaim volumes used by
// the pod. This ensures that when a pod is backed up, all referenced PVCs are backed up too.
func (a *PodAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
func (a *PodAction) Execute(item runtime.Unstructured, _ *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
a.log.Info("Executing podAction")
defer a.log.Info("Done executing podAction")

Expand Down
2 changes: 1 addition & 1 deletion pkg/backup/actions/remap_crd_version_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (a *RemapCRDVersionAction) AppliesTo() (velero.ResourceSelector, error) {
}

// Execute executes logic necessary to check a CustomResourceDefinition and inspect it for characteristics that necessitate saving it as v1beta1 instead of v1.
func (a *RemapCRDVersionAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
func (a *RemapCRDVersionAction) Execute(item runtime.Unstructured, _ *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
a.logger.Info("Executing RemapCRDVersionAction")

// This plugin is only relevant for CRDs retrieved from the v1 endpoint that were installed via the v1beta1
Expand Down
2 changes: 1 addition & 1 deletion pkg/backup/actions/service_account_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (a *ServiceAccountAction) AppliesTo() (velero.ResourceSelector, error) {
// Execute checks for any ClusterRoleBindings that have this service account as a subject, and
// adds the ClusterRoleBinding and associated ClusterRole to the list of additional items to
// be backed up.
func (a *ServiceAccountAction) Execute(item runtime.Unstructured, backup *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
func (a *ServiceAccountAction) Execute(item runtime.Unstructured, _ *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error) {
a.log.Info("Running ServiceAccountAction")
defer a.log.Info("Done running ServiceAccountAction")

Expand Down
22 changes: 11 additions & 11 deletions pkg/backup/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ func TestBackupActionAdditionalItems(t *testing.T) {
},
actions: []biav2.BackupItemAction{
&pluggableAction{
executeFunc: func(item runtime.Unstructured, backup *velerov1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, string, []velero.ResourceIdentifier, error) {
executeFunc: func(item runtime.Unstructured, _ *velerov1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, string, []velero.ResourceIdentifier, error) {
additionalItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-1"},
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-2"},
Expand Down Expand Up @@ -2113,7 +2113,7 @@ func TestBackupActionAdditionalItems(t *testing.T) {
actions: []biav2.BackupItemAction{
&pluggableAction{
selector: velero.ResourceSelector{IncludedNamespaces: []string{"ns-1"}},
executeFunc: func(item runtime.Unstructured, backup *velerov1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, string, []velero.ResourceIdentifier, error) {
executeFunc: func(item runtime.Unstructured, _ *velerov1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, string, []velero.ResourceIdentifier, error) {
additionalItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.Pods, Namespace: "ns-4", Name: "pod-4"},
{GroupResource: kuberesource.Pods, Namespace: "ns-5", Name: "pod-5"},
Expand Down Expand Up @@ -2520,7 +2520,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
selector: velero.ResourceSelector{IncludedNamespaces: []string{"ns-1"}},
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.Pods, Namespace: "ns-2", Name: "pod-2"},
{GroupResource: kuberesource.Pods, Namespace: "ns-3", Name: "pod-3"},
Expand Down Expand Up @@ -2551,7 +2551,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
},
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.Pods, Namespace: "ns-2", Name: "pod-2"},
{GroupResource: kuberesource.Pods, Namespace: "ns-3", Name: "pod-3"},
Expand Down Expand Up @@ -2581,7 +2581,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
},
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-1"},
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-2"},
Expand Down Expand Up @@ -2614,7 +2614,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
},
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-1"},
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-2"},
Expand Down Expand Up @@ -2644,7 +2644,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
},
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-1"},
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-2"},
Expand Down Expand Up @@ -2675,7 +2675,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
},
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-1"},
{GroupResource: kuberesource.PersistentVolumes, Name: "pv-2"},
Expand Down Expand Up @@ -2706,7 +2706,7 @@ func TestItemBlockActionRelatedItems(t *testing.T) {
actions: []ibav1.ItemBlockAction{
&pluggableIBA{
selector: velero.ResourceSelector{IncludedNamespaces: []string{"ns-1"}},
getRelatedItemsFunc: func(item runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
getRelatedItemsFunc: func(_ runtime.Unstructured, backup *velerov1.Backup) ([]velero.ResourceIdentifier, error) {
relatedItems := []velero.ResourceIdentifier{
{GroupResource: kuberesource.Pods, Namespace: "ns-4", Name: "pod-4"},
{GroupResource: kuberesource.Pods, Namespace: "ns-5", Name: "pod-5"},
Expand Down Expand Up @@ -2818,7 +2818,7 @@ func (vs *fakeVolumeSnapshotter) WithVolume(pvName, id, az, volumeType string, i
}

// Init is a no-op.
func (*fakeVolumeSnapshotter) Init(config map[string]string) error {
func (*fakeVolumeSnapshotter) Init(_ map[string]string) error {
return nil
}

Expand All @@ -2838,7 +2838,7 @@ func (vs *fakeVolumeSnapshotter) GetVolumeID(pv runtime.Unstructured) (string, e
// CreateSnapshot looks up the volume in the Volume map. If it's not found, an error is
// returned; if snapshotErr is true on the result, an error is returned; otherwise,
// a snapshotID of "<volumeID>-snapshot" is returned.
func (vs *fakeVolumeSnapshotter) CreateSnapshot(volumeID, volumeAZ string, tags map[string]string) (snapshotID string, err error) {
func (vs *fakeVolumeSnapshotter) CreateSnapshot(volumeID, volumeAZ string, _ map[string]string) (snapshotID string, err error) {
vi, ok := vs.Volumes[volumeIdentifier{volumeID: volumeID, volumeAZ: volumeAZ}]
if !ok {
return "", errors.New("volume not found")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/backup/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
c := &cobra.Command{
Use: use + " [NAME1] [NAME2] [NAME...]",
Short: "Describe backups",
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {
kbClient, err := f.KubebuilderClient()
cmd.CheckError(err)

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/cli/backup/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (o *DownloadOptions) BindFlags(flags *pflag.FlagSet) {
flags.StringVar(&o.caCertFile, "cacert", o.caCertFile, "Path to a certificate bundle to use when verifying TLS connections.")
}

func (o *DownloadOptions) Validate(c *cobra.Command, args []string, f client.Factory) error {
func (o *DownloadOptions) Validate(_ *cobra.Command, args []string, f client.Factory) error {
kbClient, err := f.KubebuilderClient()
cmd.CheckError(err)

Expand Down Expand Up @@ -114,7 +114,7 @@ func (o *DownloadOptions) Complete(args []string) error {
return nil
}

func (o *DownloadOptions) Run(c *cobra.Command, f client.Factory) error {
func (o *DownloadOptions) Run(_ *cobra.Command, f client.Factory) error {
kbClient, err := f.KubebuilderClient()
cmd.CheckError(err)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/backup/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (l *LogsOptions) BindFlags(flags *pflag.FlagSet) {
flags.StringVar(&l.CaCertFile, "cacert", l.CaCertFile, "Path to a certificate bundle to use when verifying TLS connections.")
}

func (l *LogsOptions) Run(c *cobra.Command, f client.Factory) error {
func (l *LogsOptions) Run(_ *cobra.Command, f client.Factory) error {
backup := new(velerov1api.Backup)
err := l.Client.Get(context.TODO(), kbclient.ObjectKey{Namespace: f.Namespace(), Name: l.BackupName}, backup)
if apierrors.IsNotFound(err) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/bug/bug.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func NewCommand() *cobra.Command {
Use: "bug",
Short: "Report a Velero bug",
Long: "Open a browser window to report a Velero bug",
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {

Check warning on line 110 in pkg/cmd/cli/bug/bug.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/bug/bug.go#L110

Added line #L110 was not covered by tests
kubectlVersion, err := getKubectlVersion()
if err != nil {
// we don't want to prevent the user from submitting a bug
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/client/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewGetCommand() *cobra.Command {
c := &cobra.Command{
Use: "get [KEY 1] [KEY 2] [...]",
Short: "Get client configuration file values",
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {

Check warning on line 33 in pkg/cmd/cli/client/config/get.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/client/config/get.go#L33

Added line #L33 was not covered by tests
config, err := client.LoadConfig()
cmd.CheckError(err)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/client/config/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewSetCommand() *cobra.Command {
Use: "set KEY=VALUE [KEY=VALUE]...",
Short: "Set client configuration file values",
Args: cobra.MinimumNArgs(1),
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {

Check warning on line 35 in pkg/cmd/cli/client/config/set.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/client/config/set.go#L35

Added line #L35 was not covered by tests
config, err := client.LoadConfig()
cmd.CheckError(err)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func NewCommand(f client.Factory) *cobra.Command {
Short: "Generate debug bundle",
Long: `Generate a tarball containing the logs of velero deployment, plugin logs, node-agent DaemonSet,
specs of resources created by velero server, and optionally the logs of backup and restore.`,
Run: func(c *cobra.Command, args []string) {
Run: func(c *cobra.Command, _ []string) {

Check warning on line 156 in pkg/cmd/cli/debug/debug.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/debug/debug.go#L156

Added line #L156 was not covered by tests
flags := c.Flags()
err := o.complete(f, flags)
cmd.CheckError(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/delete_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (o *DeleteOptions) Complete(f client.Factory, args []string) error {
}

// Validate validates the fields of the DeleteOptions struct.
func (o *DeleteOptions) Validate(c *cobra.Command, f client.Factory, args []string) error {
func (o *DeleteOptions) Validate(_ *cobra.Command, _ client.Factory, args []string) error {

Check failure on line 57 in pkg/cmd/cli/delete_options.go

View workflow job for this annotation

GitHub Actions / Run Linter Check

unused-parameter: parameter 'args' seems to be unused, consider removing or renaming it as _ (revive)

Check warning on line 57 in pkg/cmd/cli/delete_options.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/delete_options.go#L57

Added line #L57 was not covered by tests
if o.Client == nil {
return errors.New("velero client is not set; unable to proceed")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/schedule/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
c := &cobra.Command{
Use: use + " [NAME1] [NAME2] [NAME...]",
Short: "Describe schedules",
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {

Check warning on line 40 in pkg/cmd/cli/schedule/describe.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/schedule/describe.go#L40

Added line #L40 was not covered by tests
crClient, err := f.KubebuilderClient()
cmd.CheckError(err)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/schedule/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewPauseCommand(f client.Factory, use string) *cobra.Command {
# Pause all schedules.
velero schedule pause --all`,
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {

Check warning on line 56 in pkg/cmd/cli/schedule/pause.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/schedule/pause.go#L56

Added line #L56 was not covered by tests
cmd.CheckError(o.Complete(args))
cmd.CheckError(o.Validate())
cmd.CheckError(runPause(f, o, true, pauseOpts.SkipOptions.SkipImmediately.Value))
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/schedule/unpause.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewUnpauseCommand(f client.Factory, use string) *cobra.Command {
# Unpause all schedules.
velero schedule unpause --all`,
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {

Check warning on line 45 in pkg/cmd/cli/schedule/unpause.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/schedule/unpause.go#L45

Added line #L45 was not covered by tests
cmd.CheckError(o.Complete(args))
cmd.CheckError(o.Validate())
cmd.CheckError(runPause(f, o, false, pauseOpts.SkipOptions.SkipImmediately.Value))
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/cli/snapshotlocation/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (o *CreateOptions) BindFlags(flags *pflag.FlagSet) {
flags.Var(&o.Credential, "credential", "The credential to be used by this location as a key-value pair, where the key is the Kubernetes Secret name, and the value is the data key name within the Secret. Optional, one value only.")
}

func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Factory) error {
func (o *CreateOptions) Validate(c *cobra.Command, _ []string, _ client.Factory) error {

Check warning on line 80 in pkg/cmd/cli/snapshotlocation/create.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/snapshotlocation/create.go#L80

Added line #L80 was not covered by tests
if err := output.ValidateFlags(c); err != nil {
return err
}
Expand All @@ -93,7 +93,7 @@ func (o *CreateOptions) Validate(c *cobra.Command, args []string, f client.Facto
return nil
}

func (o *CreateOptions) Complete(args []string, f client.Factory) error {
func (o *CreateOptions) Complete(args []string, _ client.Factory) error {

Check warning on line 96 in pkg/cmd/cli/snapshotlocation/create.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/snapshotlocation/create.go#L96

Added line #L96 was not covered by tests
o.Name = args[0]
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/cli/snapshotlocation/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (o *SetOptions) BindFlags(flags *pflag.FlagSet) {
flags.Var(&o.Credential, "credential", "Sets the credential to be used by this location as a key-value pair, where the key is the Kubernetes Secret name, and the value is the data key name within the Secret. Optional, one value only.")
}

func (o *SetOptions) Validate(c *cobra.Command, args []string, f client.Factory) error {
func (o *SetOptions) Validate(c *cobra.Command, _ []string, _ client.Factory) error {

Check warning on line 70 in pkg/cmd/cli/snapshotlocation/set.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/snapshotlocation/set.go#L70

Added line #L70 was not covered by tests
if err := output.ValidateFlags(c); err != nil {
return err
}
Expand All @@ -79,12 +79,12 @@ func (o *SetOptions) Validate(c *cobra.Command, args []string, f client.Factory)
return nil
}

func (o *SetOptions) Complete(args []string, f client.Factory) error {
func (o *SetOptions) Complete(args []string, _ client.Factory) error {

Check warning on line 82 in pkg/cmd/cli/snapshotlocation/set.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/snapshotlocation/set.go#L82

Added line #L82 was not covered by tests
o.Name = args[0]
return nil
}

func (o *SetOptions) Run(c *cobra.Command, f client.Factory) error {
func (o *SetOptions) Run(_ *cobra.Command, f client.Factory) error {

Check warning on line 87 in pkg/cmd/cli/snapshotlocation/set.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/snapshotlocation/set.go#L87

Added line #L87 was not covered by tests
kbClient, err := f.KubebuilderClient()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cli/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewCommand(f client.Factory) *cobra.Command {
c := &cobra.Command{
Use: "version",
Short: "Print the velero version and associated image",
Run: func(c *cobra.Command, args []string) {
Run: func(_ *cobra.Command, args []string) {

Check warning on line 43 in pkg/cmd/cli/version/version.go

View check run for this annotation

Codecov / codecov/patch

pkg/cmd/cli/version/version.go#L43

Added line #L43 was not covered by tests
var kbClient kbclient.Client
if !clientOnly {
var err error
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/util/output/backup_describer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ func TestDescribeNativeSnapshots(t *testing.T) {
}

for _, tc := range testcases {
t.Run(tc.name, func(tt *testing.T) {
t.Run(tc.name, func(t *testing.T) {
d := &Describer{
Prefix: "",
out: &tabwriter.Writer{},
Expand Down Expand Up @@ -541,7 +541,7 @@ func TestCSISnapshots(t *testing.T) {
}

for _, tc := range testcases {
t.Run(tc.name, func(tt *testing.T) {
t.Run(tc.name, func(t *testing.T) {
d := &Describer{
Prefix: "",
out: &tabwriter.Writer{},
Expand Down
4 changes: 2 additions & 2 deletions pkg/nodeagent/node_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestIsRunning(t *testing.T) {
{
verb: "get",
resource: "daemonsets",
reactorFunc: func(action clientTesting.Action) (handled bool, ret runtime.Object, err error) {
reactorFunc: func(_ clientTesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, errors.New("fake-get-error")
},
},
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestGetConfigs(t *testing.T) {
{
verb: "get",
resource: "configmaps",
reactorFunc: func(action clientTesting.Action) (handled bool, ret runtime.Object, err error) {
reactorFunc: func(_ clientTesting.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, errors.New("fake-get-error")
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/persistence/in_memory_object_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (o *inMemoryObjectStore) DeleteObject(bucket, key string) error {
return nil
}

func (o *inMemoryObjectStore) CreateSignedURL(bucket, key string, ttl time.Duration) (string, error) {
func (o *inMemoryObjectStore) CreateSignedURL(bucket, key string, _ time.Duration) (string, error) {
bucketData, ok := o.Data[bucket]
if !ok {
return "", errors.New("bucket not found")
Expand Down
Loading

0 comments on commit 79d8659

Please sign in to comment.