Skip to content

Commit

Permalink
Enable unused-parameter revive flag
Browse files Browse the repository at this point in the history
Signed-off-by: Elena Gershkovich <[email protected]>
  • Loading branch information
ELENAGER committed Dec 11, 2023
1 parent 7af53f8 commit daf93fe
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ linters-settings:
- name: unhandled-error
# - name: flag-parameter
# - name: unused-receiver
# - name: unused-parameter
- name: unused-parameter
# - name: confusing-naming
# - name: import-shadowing
# - name: confusing-results
Expand Down
6 changes: 3 additions & 3 deletions controllers/drcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var baseNF = &csiaddonsv1alpha1.NetworkFence{
},
}

func (f FakeMCVGetter) GetNFFromManagedCluster(resourceName, resourceNamespace, managedCluster string,
annotations map[string]string,
func (f FakeMCVGetter) GetNFFromManagedCluster(_, _, _ string,
_ map[string]string,
) (*csiaddonsv1alpha1.NetworkFence, error) {
nfStatus := csiaddonsv1alpha1.NetworkFenceStatus{
Result: csiaddonsv1alpha1.FencingOperationResultSucceeded,
Expand All @@ -57,7 +57,7 @@ func (f FakeMCVGetter) GetNFFromManagedCluster(resourceName, resourceNamespace,
}

func (f FakeMCVGetter) DeleteNFManagedClusterView(
resourceName, resourceNamespace, clusterName, resourceType string,
_, _, _, _ string,
) error {
return nil
}
Expand Down
22 changes: 11 additions & 11 deletions controllers/drplacementcontrol_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func getSyncDRPolicy() *rmn.DRPolicy {
var drstate string

// FakeProgressCallback of function type
func FakeProgressCallback(drpcName string, state string) {
func FakeProgressCallback(_ string, state string) {
drstate = state
}

Expand Down Expand Up @@ -220,7 +220,7 @@ func getFunctionNameAtIndex(idx int) string {
// a nil mcv back in case of success
func (f FakeMCVGetter) GetMModeFromManagedCluster(
resourceName, managedCluster string,
annotations map[string]string,
_ map[string]string,
) (*rmn.MaintenanceMode, error) {
mModeMCV := &viewv1beta1.ManagedClusterView{}

Expand Down Expand Up @@ -321,7 +321,7 @@ func (f FakeMCVGetter) GetResource(mcv *viewv1beta1.ManagedClusterView, resource
// DeleteManagedClusterView: This fake function would eventually delete the MMode MCV that is created
// by the call to GetMModeFromManagedCluster. It is generic enough to delete any MCV that was created as well
// TODO: Implementation is mostly the same as the one in ManagedClusterViewGetterImpl
func (f FakeMCVGetter) DeleteManagedClusterView(clusterName, mcvName string, logger logr.Logger) error {
func (f FakeMCVGetter) DeleteManagedClusterView(clusterName, mcvName string, _ logr.Logger) error {
mcv := &viewv1beta1.ManagedClusterView{}

err := f.Get(context.TODO(), types.NamespacedName{Name: mcvName, Namespace: clusterName}, mcv)
Expand All @@ -337,7 +337,7 @@ func (f FakeMCVGetter) DeleteManagedClusterView(clusterName, mcvName string, log
}

func (f FakeMCVGetter) GetNamespaceFromManagedCluster(
resourceName, managedCluster, namespaceString string, annotations map[string]string,
resourceName, managedCluster, namespaceString string, _ map[string]string,
) (*corev1.Namespace, error) {
appNamespaceObj := &corev1.Namespace{}

Expand Down Expand Up @@ -381,8 +381,8 @@ func isRestorePVsComplete() bool {
}

//nolint:funlen,cyclop,gocognit
func (f FakeMCVGetter) GetVRGFromManagedCluster(resourceName, resourceNamespace, managedCluster string,
annnotations map[string]string,
func (f FakeMCVGetter) GetVRGFromManagedCluster(_, _, managedCluster string,
_ map[string]string,
) (*rmn.VolumeReplicationGroup, error) {
conType := controllers.VRGConditionTypeDataReady
reason := controllers.VRGConditionReasonReplicating
Expand Down Expand Up @@ -487,13 +487,13 @@ func (f FakeMCVGetter) GetVRGFromManagedCluster(resourceName, resourceNamespace,
}

func (f FakeMCVGetter) DeleteVRGManagedClusterView(
resourceName, resourceNamespace, clusterName, resourceType string,
_, _, _, _ string,
) error {
return nil
}

func (f FakeMCVGetter) DeleteNamespaceManagedClusterView(
resourceName, resourceNamespace, clusterName, resourceType string,
_, _, _, _ string,
) error {
return nil
}
Expand Down Expand Up @@ -1125,7 +1125,7 @@ const (
UsePlacementWithAppSet = 3
)

func InitialDeploymentAsync(namespace, placementName, homeCluster string, plType PlacementType) (
func InitialDeploymentAsync(namespace, placementName, _ string, plType PlacementType) (
client.Object, *rmn.DRPlacementControl,
) {
createNamespacesAsync(getNamespaceObj(DRPCNamespaceName))
Expand All @@ -1152,7 +1152,7 @@ func InitialDeploymentAsync(namespace, placementName, homeCluster string, plType
return placementObj, createDRPC(placementName, DRPCName, DRPCNamespaceName, AsyncDRPolicyName)
}

func FollowOnDeploymentAsync(namespace, placementName, homeCluster string) (*plrv1.PlacementRule,
func FollowOnDeploymentAsync(namespace, placementName, _ string) (*plrv1.PlacementRule,
*rmn.DRPlacementControl,
) {
createNamespace(appNamespace2)
Expand Down Expand Up @@ -1620,7 +1620,7 @@ func createNamespacesSync() {
createNamespace(appNamespace)
}

func InitialDeploymentSync(namespace, placementName, homeCluster string) (*plrv1.PlacementRule,
func InitialDeploymentSync(namespace, placementName, _ string) (*plrv1.PlacementRule,
*rmn.DRPlacementControl,
) {
createNamespacesSync()
Expand Down
2 changes: 1 addition & 1 deletion controllers/kubeobjects/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type HookSpec struct {

func RequestProcessingErrorCreate(s string) RequestProcessingError { return RequestProcessingError{s} }
func (e RequestProcessingError) Error() string { return e.string }
func (RequestProcessingError) Is(err error) bool { return true }
func (RequestProcessingError) Is(_ error) bool { return true }

type RequestsManager interface {
ProtectsPath() string
Expand Down
2 changes: 1 addition & 1 deletion controllers/s3utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type s3ObjectStoreGetter struct{}
// secret is not configured, or if client session creation fails.
func (s3ObjectStoreGetter) ObjectStore(ctx context.Context,
r client.Reader, s3ProfileName string,
callerTag string, log logr.Logger,
callerTag string, _ logr.Logger,
) (ObjectStorer, ramen.S3StoreProfile, error) {
s3StoreProfile, err := GetRamenConfigS3StoreProfile(ctx, r, s3ProfileName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion controllers/s3utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (fakeObjectStoreGetter) ObjectStore(
apiReader client.Reader,
s3ProfileName string,
callerTag string,
log logr.Logger,
_ logr.Logger,
) (controllers.ObjectStorer, ramen.S3StoreProfile, error) {
s3StoreProfile, err := controllers.GetRamenConfigS3StoreProfile(ctx, apiReader, s3ProfileName)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions controllers/util/mcv_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func (m ManagedClusterViewGetterImpl) getOrCreateManagedClusterView(
}

func (m ManagedClusterViewGetterImpl) DeleteVRGManagedClusterView(
resourceName, resourceNamespace, clusterName, resourceType string,
resourceName, resourceNamespace, clusterName, _ string,
) error {
logger := ctrl.Log.WithName("MCV").WithValues("resouceName", resourceName)
mcvNameVRG := BuildManagedClusterViewName(resourceName, resourceNamespace, MWTypeVRG)
Expand All @@ -353,7 +353,7 @@ func (m ManagedClusterViewGetterImpl) DeleteVRGManagedClusterView(
}

func (m ManagedClusterViewGetterImpl) DeleteNamespaceManagedClusterView(
resourceName, resourceNamespace, clusterName, resourceType string,
resourceName, resourceNamespace, clusterName, _ string,
) error {
logger := ctrl.Log.WithName("MCV").WithValues("resouceName", resourceName)
mcvNameNS := BuildManagedClusterViewName(resourceName, resourceNamespace, MWTypeNS)
Expand All @@ -362,7 +362,7 @@ func (m ManagedClusterViewGetterImpl) DeleteNamespaceManagedClusterView(
}

func (m ManagedClusterViewGetterImpl) DeleteNFManagedClusterView(
resourceName, resourceNamespace, clusterName, resourceType string,
resourceName, resourceNamespace, clusterName, _ string,
) error {
logger := ctrl.Log.WithName("MCV").WithValues("resouceName", resourceName)
mcvNameNF := BuildManagedClusterViewName(resourceName, resourceNamespace, MWTypeNF)
Expand Down
6 changes: 3 additions & 3 deletions controllers/util/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (

type CreateOrDeleteOrResourceVersionUpdatePredicate struct{}

func (CreateOrDeleteOrResourceVersionUpdatePredicate) Create(e event.CreateEvent) bool {
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Create(_ event.CreateEvent) bool {
return true
}

func (CreateOrDeleteOrResourceVersionUpdatePredicate) Delete(e event.DeleteEvent) bool {
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Delete(_ event.DeleteEvent) bool {
return true
}

func (CreateOrDeleteOrResourceVersionUpdatePredicate) Update(e event.UpdateEvent) bool {
return predicate.ResourceVersionChangedPredicate{}.Update(e)
}

func (CreateOrDeleteOrResourceVersionUpdatePredicate) Generic(e event.GenericEvent) bool {
func (CreateOrDeleteOrResourceVersionUpdatePredicate) Generic(_ event.GenericEvent) bool {
return false
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/vrg_kubeobjects.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ func (v *VRGInstance) kubeObjectsCaptureStartOrResumeOrDelay(
}

func kubeObjectsCaptureStartConditionallySecondary(
v *VRGInstance, result *ctrl.Result,
captureStartGeneration int64, captureStartTimeSince, captureStartInterval time.Duration,
v *VRGInstance, _ *ctrl.Result,
captureStartGeneration int64, _, _ time.Duration,
captureStart func(),
) {
generation := v.instance.Generation
Expand All @@ -187,7 +187,7 @@ func kubeObjectsCaptureStartConditionallySecondary(

func kubeObjectsCaptureStartConditionallyPrimary(
v *VRGInstance, result *ctrl.Result,
captureStartGeneration int64, captureStartTimeSince, captureStartInterval time.Duration,
_ int64, captureStartTimeSince, captureStartInterval time.Duration,
captureStart func(),
) {
if delay := captureStartInterval - captureStartTimeSince; delay > 0 {
Expand Down
2 changes: 1 addition & 1 deletion controllers/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ func (v *VRGInstance) UploadPVAndPVCtoS3(s3ProfileName string, objectStore Objec
}

func (v *VRGInstance) UploadPVandPVCtoS3Stores(pvc *corev1.PersistentVolumeClaim,
log logr.Logger,
_ logr.Logger,
) ([]string, error) {
succeededProfiles := []string{}
// Upload the PV to all the S3 profiles in the VRG spec
Expand Down
6 changes: 3 additions & 3 deletions controllers/vrg_volrep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1788,14 +1788,14 @@ func pvcUnprotectedVerify(
type pvcPreDeleteVerify func(ramendrv1alpha1.VolumeReplicationGroup, types.NamespacedName, string)

func vrgPvcStatusAbsentVerify(
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, pvName string,
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, _ string,
) {
By("not storing PVC in VRG's status")
Expect(vrgController.FindProtectedPVC(&vrg, pvcNamespacedName.Namespace, pvcNamespacedName.Name)).To(BeNil())
}

func pvcClusterDataProtectedFalseVerify(
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, pvName string,
vrg ramendrv1alpha1.VolumeReplicationGroup, pvcNamespacedName types.NamespacedName, _ string,
) {
vrgPvcStatus := vrgPvcStatusGet(vrg, pvcNamespacedName)

Expand Down Expand Up @@ -1835,7 +1835,7 @@ func pvcClusterDataProtectedStatusVerify(

type pvcPostDeleteVerify func(types.NamespacedName, string)

func vrAndPvcDeletionTimestampsRecentVerify(pvcNamespacedName types.NamespacedName, pvName string) {
func vrAndPvcDeletionTimestampsRecentVerify(pvcNamespacedName types.NamespacedName, _ string) {
vrDeletionTimestampRecentVerify(pvcNamespacedName)
pvcDeletionTimestampRecentVerify(pvcNamespacedName)
}
Expand Down

0 comments on commit daf93fe

Please sign in to comment.