Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable unused-parameter from revive #8625

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ linters-settings:
disabled: true
- name: unreachable-code
- name: unused-parameter
disabled: true
- name: use-any
- name: var-declaration
- name: var-naming
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 @@
UpdateFunc: func(_, newObj any) {
handler(newObj)
},
DeleteFunc: func(obj any) {
DeleteFunc: func(_ any) {

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, _ 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 @@
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
6 changes: 3 additions & 3 deletions pkg/backup/actions/csi/volumesnapshot_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (p *volumeSnapshotBackupItemAction) Name() string {

func (p *volumeSnapshotBackupItemAction) Progress(
operationID string,
backup *velerov1api.Backup,
_ *velerov1api.Backup,
) (velero.OperationProgress, error) {
progress := velero.OperationProgress{}
if operationID == "" {
Expand Down Expand Up @@ -360,8 +360,8 @@ func (p *volumeSnapshotBackupItemAction) Progress(

// Cancel is not implemented for VolumeSnapshotBackupItemAction
func (p *volumeSnapshotBackupItemAction) Cancel(
operationID string,
backup *velerov1api.Backup,
_ string,
_ *velerov1api.Backup,
) error {
// CSI Specification doesn't support canceling a snapshot creation.
return nil
Expand Down
10 changes: 5 additions & 5 deletions pkg/backup/actions/csi/volumesnapshotclass_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *volumeSnapshotClassBackupItemAction) AppliesTo() (
// items any snapshot lister secret that may be referenced in its annotations.
func (p *volumeSnapshotClassBackupItemAction) Execute(
item runtime.Unstructured,
backup *velerov1api.Backup,
_ *velerov1api.Backup,
) (
runtime.Unstructured,
[]velero.ResourceIdentifier,
Expand Down Expand Up @@ -103,16 +103,16 @@ func (p *volumeSnapshotClassBackupItemAction) Name() string {

// Progress is not implemented for VolumeSnapshotClassBackupItemAction
func (p *volumeSnapshotClassBackupItemAction) Progress(
operationID string,
backup *velerov1api.Backup,
_ string,
_ *velerov1api.Backup,
) (velero.OperationProgress, error) {
return velero.OperationProgress{}, nil
}

// Cancel is not implemented for VolumeSnapshotClassBackupItemAction
func (p *volumeSnapshotClassBackupItemAction) Cancel(
operationID string,
backup *velerov1api.Backup,
_ string,
_ *velerov1api.Backup,
) error {
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/backup/actions/csi/volumesnapshotcontent_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ func (p *volumeSnapshotContentBackupItemAction) Name() string {

// Progress is not implemented for VolumeSnapshotContentBackupItemAction.
func (p *volumeSnapshotContentBackupItemAction) Progress(
operationID string,
backup *velerov1api.Backup,
_ string,
_ *velerov1api.Backup,
) (velero.OperationProgress, error) {
return velero.OperationProgress{}, nil
}

// Cancel is not implemented for VolumeSnapshotContentBackupItemAction.
func (p *volumeSnapshotContentBackupItemAction) Cancel(
operationID string,
backup *velerov1api.Backup,
_ string,
_ *velerov1api.Backup,
) error {
// CSI Specification doesn't support canceling a snapshot creation.
return nil
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
Loading
Loading