Merge pull request #3398 from whitewindmills/code-cleanup

Fix inspection errors
This commit is contained in:
karmada-bot 2023-05-19 20:28:53 +08:00 committed by GitHub
commit 8594406e5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 108 additions and 108 deletions

View File

@ -7,16 +7,16 @@ import (
) )
// Validate checks Options and return a slice of found errs. // Validate checks Options and return a slice of found errs.
func (opts *Options) Validate() field.ErrorList { func (o *Options) Validate() field.ErrorList {
errs := field.ErrorList{} errs := field.ErrorList{}
rootPath := field.NewPath("Options") rootPath := field.NewPath("Options")
if net.ParseIP(opts.BindAddress) == nil { if net.ParseIP(o.BindAddress) == nil {
errs = append(errs, field.Invalid(rootPath.Child("BindAddress"), opts.BindAddress, "not a valid textual representation of an IP address")) errs = append(errs, field.Invalid(rootPath.Child("BindAddress"), o.BindAddress, "not a valid textual representation of an IP address"))
} }
if opts.SecurePort < 0 || opts.SecurePort > 65535 { if o.SecurePort < 0 || o.SecurePort > 65535 {
errs = append(errs, field.Invalid(rootPath.Child("SecurePort"), opts.SecurePort, "must be a valid port between 0 and 65535 inclusive")) errs = append(errs, field.Invalid(rootPath.Child("SecurePort"), o.SecurePort, "must be a valid port between 0 and 65535 inclusive"))
} }
return errs return errs

View File

@ -26,7 +26,7 @@ type workloadInterpreter struct {
// Handle implements interpreter.Handler interface. // Handle implements interpreter.Handler interface.
// It yields a response to an ExploreRequest. // It yields a response to an ExploreRequest.
func (e *workloadInterpreter) Handle(ctx context.Context, req interpreter.Request) interpreter.Response { func (e *workloadInterpreter) Handle(_ context.Context, req interpreter.Request) interpreter.Response {
workload := &workloadv1alpha1.Workload{} workload := &workloadv1alpha1.Workload{}
err := e.decoder.Decode(req, workload) err := e.decoder.Decode(req, workload)
if err != nil { if err != nil {

View File

@ -5,6 +5,6 @@ import (
) )
// Name returns the image name. // Name returns the image name.
func (image Image) Name() string { func (image *Image) Name() string {
return fmt.Sprintf("%s:%s", image.ImageRepository, image.ImageTag) return fmt.Sprintf("%s:%s", image.ImageRepository, image.ImageTag)
} }

View File

@ -9,7 +9,7 @@ import (
operator "github.com/karmada-io/karmada/operator/pkg" operator "github.com/karmada-io/karmada/operator/pkg"
operatorv1alpha1 "github.com/karmada-io/karmada/operator/pkg/apis/operator/v1alpha1" operatorv1alpha1 "github.com/karmada-io/karmada/operator/pkg/apis/operator/v1alpha1"
workflow "github.com/karmada-io/karmada/operator/pkg/workflow" "github.com/karmada-io/karmada/operator/pkg/workflow"
) )
// Action is a intention corresponding karmada resource modification // Action is a intention corresponding karmada resource modification

View File

@ -56,7 +56,7 @@ func skipCerts(d workflow.RunData) (bool, error) {
} }
func newCertSubTasks() []workflow.Task { func newCertSubTasks() []workflow.Task {
subTasks := []workflow.Task{} var subTasks []workflow.Task
caCert := map[string]*certs.CertConfig{} caCert := map[string]*certs.CertConfig{}
for _, cert := range certs.GetDefaultCertList() { for _, cert := range certs.GetDefaultCertList() {

View File

@ -179,9 +179,9 @@ func runUploadKarmadaCert(r workflow.RunData) error {
return errors.New("upload-KarmadaCert task invoked with an invalid data struct") return errors.New("upload-KarmadaCert task invoked with an invalid data struct")
} }
certs := data.CertList() certList := data.CertList()
certsData := make(map[string][]byte, len(certs)) certsData := make(map[string][]byte, len(certList))
for _, c := range certs { for _, c := range certList {
certsData[c.KeyName()] = c.KeyData() certsData[c.KeyName()] = c.KeyData()
certsData[c.CertName()] = c.CertData() certsData[c.CertName()] = c.CertData()
} }

View File

@ -95,7 +95,7 @@ func (d *ClusterDetector) OnAdd(obj interface{}) {
} }
// OnUpdate handles object update event and push the object to queue. // OnUpdate handles object update event and push the object to queue.
func (d *ClusterDetector) OnUpdate(oldObj, newObj interface{}) { func (d *ClusterDetector) OnUpdate(_, newObj interface{}) {
d.OnAdd(newObj) d.OnAdd(newObj)
} }

View File

@ -195,7 +195,7 @@ func (c *CertRotationController) syncCertRotation(secret *corev1.Secret) error {
secret.Data["karmada-kubeconfig"] = karmadaKubeconfigBytes secret.Data["karmada-kubeconfig"] = karmadaKubeconfigBytes
// Update the karmada-kubeconfig secret in the member cluster. // Update the karmada-kubeconfig secret in the member cluster.
if _, err := c.ClusterClient.KubeClient.CoreV1().Secrets(secret.Namespace).Update(context.TODO(), secret, metav1.UpdateOptions{}); err != nil { if _, err := c.ClusterClient.KubeClient.CoreV1().Secrets(secret.Namespace).Update(context.TODO(), secret, metav1.UpdateOptions{}); err != nil {
return fmt.Errorf("Unable to update secret, err: %w", err) return fmt.Errorf("unable to update secret, err: %w", err)
} }
newCert, err := certutil.ParseCertsPEM(newCertData) newCert, err := certutil.ParseCertsPEM(newCertData)

View File

@ -157,7 +157,7 @@ func (c *Controller) buildWorks(namespace *corev1.Namespace, clusters []clusterv
}(&clusters[i], errChan) }(&clusters[i], errChan)
} }
errs := []error{} var errs []error
for range clusters { for range clusters {
if err := <-errChan; err != nil { if err := <-errChan; err != nil {
errs = append(errs, err) errs = append(errs, err)

View File

@ -369,7 +369,7 @@ func (c *WorkStatusController) buildStatusIdentifier(work *workv1alpha1.Work, cl
return identifier, nil return identifier, nil
} }
func (c *WorkStatusController) mergeStatus(statuses []workv1alpha1.ManifestStatus, newStatus workv1alpha1.ManifestStatus) []workv1alpha1.ManifestStatus { func (c *WorkStatusController) mergeStatus(_ []workv1alpha1.ManifestStatus, newStatus workv1alpha1.ManifestStatus) []workv1alpha1.ManifestStatus {
// TODO(RainbowMango): update 'statuses' if 'newStatus' already exist. // TODO(RainbowMango): update 'statuses' if 'newStatus' already exist.
// For now, we only have at most one manifest in Work, so just override current 'statuses'. // For now, we only have at most one manifest in Work, so just override current 'statuses'.
return []workv1alpha1.ManifestStatus{newStatus} return []workv1alpha1.ManifestStatus{newStatus}

View File

@ -151,7 +151,7 @@ func (d *DependenciesDistributor) OnAdd(obj interface{}) {
} }
// OnUpdate handles object update event and push the object to queue. // OnUpdate handles object update event and push the object to queue.
func (d *DependenciesDistributor) OnUpdate(oldObj, newObj interface{}) { func (d *DependenciesDistributor) OnUpdate(_, newObj interface{}) {
d.OnAdd(newObj) d.OnAdd(newObj)
} }
@ -537,7 +537,7 @@ func (d *DependenciesDistributor) removeScheduleResultFromAttachedBindings(bindi
} }
func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstructured.Unstructured) *workv1alpha2.ResourceBinding { func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstructured.Unstructured) *workv1alpha2.ResourceBinding {
labels := generateBindingDependedByLabel(binding.Namespace, binding.Name) dependedByLabels := generateBindingDependedByLabel(binding.Namespace, binding.Name)
var result []workv1alpha2.BindingSnapshot var result []workv1alpha2.BindingSnapshot
result = append(result, workv1alpha2.BindingSnapshot{ result = append(result, workv1alpha2.BindingSnapshot{
@ -553,7 +553,7 @@ func buildAttachedBinding(binding *workv1alpha2.ResourceBinding, object *unstruc
OwnerReferences: []metav1.OwnerReference{ OwnerReferences: []metav1.OwnerReference{
*metav1.NewControllerRef(object, object.GroupVersionKind()), *metav1.NewControllerRef(object, object.GroupVersionKind()),
}, },
Labels: labels, Labels: dependedByLabels,
Finalizers: []string{util.BindingControllerFinalizer}, Finalizers: []string{util.BindingControllerFinalizer},
}, },
Spec: workv1alpha2.ResourceBindingSpec{ Spec: workv1alpha2.ResourceBindingSpec{

View File

@ -767,7 +767,7 @@ func (d *ResourceDetector) OnPropagationPolicyAdd(obj interface{}) {
} }
// OnPropagationPolicyUpdate handles object update event and push the object to queue. // OnPropagationPolicyUpdate handles object update event and push the object to queue.
func (d *ResourceDetector) OnPropagationPolicyUpdate(oldObj, newObj interface{}) { func (d *ResourceDetector) OnPropagationPolicyUpdate(_, newObj interface{}) {
key, err := ClusterWideKeyFunc(newObj) key, err := ClusterWideKeyFunc(newObj)
if err != nil { if err != nil {
return return
@ -831,7 +831,7 @@ func (d *ResourceDetector) OnClusterPropagationPolicyAdd(obj interface{}) {
} }
// OnClusterPropagationPolicyUpdate handles object update event and push the object to queue. // OnClusterPropagationPolicyUpdate handles object update event and push the object to queue.
func (d *ResourceDetector) OnClusterPropagationPolicyUpdate(oldObj, newObj interface{}) { func (d *ResourceDetector) OnClusterPropagationPolicyUpdate(_, newObj interface{}) {
key, err := ClusterWideKeyFunc(newObj) key, err := ClusterWideKeyFunc(newObj)
if err != nil { if err != nil {
return return

View File

@ -28,7 +28,7 @@ func NewGeneralEstimator() *GeneralEstimator {
} }
// MaxAvailableReplicas estimates the maximum replicas that can be applied to the target cluster by cluster ResourceSummary. // MaxAvailableReplicas estimates the maximum replicas that can be applied to the target cluster by cluster ResourceSummary.
func (ge *GeneralEstimator) MaxAvailableReplicas(ctx context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error) { func (ge *GeneralEstimator) MaxAvailableReplicas(_ context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error) {
availableTargetClusters := make([]workv1alpha2.TargetCluster, len(clusters)) availableTargetClusters := make([]workv1alpha2.TargetCluster, len(clusters))
for i, cluster := range clusters { for i, cluster := range clusters {
maxReplicas := ge.maxAvailableReplicas(cluster, replicaRequirements) maxReplicas := ge.maxAvailableReplicas(cluster, replicaRequirements)

View File

@ -128,7 +128,7 @@ func (o *CommandApplyOptions) Validate() error {
for _, cluster := range clusters.Items { for _, cluster := range clusters.Items {
clusterSet.Insert(cluster.Name) clusterSet.Insert(cluster.Name)
} }
errs := []error{} var errs []error
for _, cluster := range o.Clusters { for _, cluster := range o.Clusters {
if !clusterSet.Has(cluster) { if !clusterSet.Has(cluster) {
errs = append(errs, fmt.Errorf("cluster %s does not exist", cluster)) errs = append(errs, fmt.Errorf("cluster %s does not exist", cluster))

View File

@ -6,18 +6,16 @@ import (
"k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/kubernetes/fake"
) )
var noError = false
func Test_grantProxyPermissionToAdmin(t *testing.T) { func Test_grantProxyPermissionToAdmin(t *testing.T) {
client := fake.NewSimpleClientset() client := fake.NewSimpleClientset()
if err := grantProxyPermissionToAdmin(client); (err != nil) != noError { if err := grantProxyPermissionToAdmin(client); err != nil {
t.Errorf("grantProxyPermissionToAdmin() error = %v, wantErr %v", err, noError) t.Errorf("grantProxyPermissionToAdmin() expected no error, but got err: %v", err)
} }
} }
func Test_grantAccessPermissionToAgent(t *testing.T) { func Test_grantAccessPermissionToAgent(t *testing.T) {
client := fake.NewSimpleClientset() client := fake.NewSimpleClientset()
if err := grantAccessPermissionToAgent(client); (err != nil) != noError { if err := grantAccessPermissionToAgent(client); err != nil {
t.Errorf("grantAccessPermissionToAgent() error = %v, wantErr %v", err, noError) t.Errorf("grantAccessPermissionToAgent() expected no error, but got err: %v", err)
} }
} }

View File

@ -168,7 +168,7 @@ func (i *CommandInitOption) karmadaAggregatedAPIServerService() *corev1.Service
} }
} }
func (i CommandInitOption) isNodePortExist() bool { func (i *CommandInitOption) isNodePortExist() bool {
svc, err := i.KubeClientSet.CoreV1().Services(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{}) svc, err := i.KubeClientSet.CoreV1().Services(metav1.NamespaceAll).List(context.TODO(), metav1.ListOptions{})
if err != nil { if err != nil {
klog.Exit(err) klog.Exit(err)

View File

@ -39,7 +39,7 @@ var (
etcdLabels = map[string]string{"app": etcdStatefulSetAndServiceName} etcdLabels = map[string]string{"app": etcdStatefulSetAndServiceName}
) )
func (i CommandInitOption) etcdVolume() (*[]corev1.Volume, *corev1.PersistentVolumeClaim) { func (i *CommandInitOption) etcdVolume() (*[]corev1.Volume, *corev1.PersistentVolumeClaim) {
var Volumes []corev1.Volume var Volumes []corev1.Volume
secretVolume := corev1.Volume{ secretVolume := corev1.Volume{

View File

@ -260,7 +260,7 @@ func (g *CommandGetOptions) Validate(cmd *cobra.Command) error {
clusterSet.Insert(cluster.Name) clusterSet.Insert(cluster.Name)
} }
noneExistClusters := []string{} var noneExistClusters []string
for _, cluster := range g.Clusters { for _, cluster := range g.Clusters {
if !clusterSet.Has(cluster) { if !clusterSet.Has(cluster) {
noneExistClusters = append(noneExistClusters, cluster) noneExistClusters = append(noneExistClusters, cluster)
@ -358,7 +358,7 @@ func (g *CommandGetOptions) Run(f util.Factory, cmd *cobra.Command, args []strin
} }
// printObjs print objects in multi clusters // printObjs print objects in multi clusters
func (g *CommandGetOptions) printObjs(objs []Obj, allErrs *[]error, args []string) { func (g *CommandGetOptions) printObjs(objs []Obj, allErrs *[]error, _ []string) {
var err error var err error
errs := sets.NewString() errs := sets.NewString()

View File

@ -82,7 +82,7 @@ func (o *Options) runEdit() error {
var ( var (
edit = editor.NewDefaultEditor(editorEnvs()) edit = editor.NewDefaultEditor(editorEnvs())
results = editResults{} results = editResults{}
edited = []byte{} edited = make([]byte, 0)
file string file string
containsError = false containsError = false
) )

View File

@ -80,15 +80,15 @@ func (o *Options) runExecute() error {
Replica: int64(o.DesiredReplica), Replica: int64(o.DesiredReplica),
} }
interpreter := declarative.NewConfigurableInterpreter(nil) configurableInterpreter := declarative.NewConfigurableInterpreter(nil)
interpreter.LoadConfig(customizations) configurableInterpreter.LoadConfig(customizations)
r := o.Rules.GetByOperation(o.Operation) r := o.Rules.GetByOperation(o.Operation)
if r == nil { if r == nil {
// Shall never occur, because we validate it before. // Shall never occur, because we validate it before.
return fmt.Errorf("operation %s is not supported. Use one of: %s", o.Operation, strings.Join(o.Rules.Names(), ", ")) return fmt.Errorf("operation %s is not supported. Use one of: %s", o.Operation, strings.Join(o.Rules.Names(), ", "))
} }
result := r.Run(interpreter, args) result := r.Run(configurableInterpreter, args)
printExecuteResult(o.Out, o.ErrOut, r.Name(), result) printExecuteResult(o.Out, o.ErrOut, r.Name(), result)
return nil return nil
} }

View File

@ -145,7 +145,7 @@ type Options struct {
} }
// Complete ensures that options are valid and marshals them if necessary // Complete ensures that options are valid and marshals them if necessary
func (o *Options) Complete(f util.Factory, cmd *cobra.Command, args []string) error { func (o *Options) Complete(f util.Factory, _ *cobra.Command, args []string) error {
if o.Check && o.Edit { if o.Check && o.Edit {
return fmt.Errorf("you can't set both --check and --edit options") return fmt.Errorf("you can't set both --check and --edit options")
} }

View File

@ -121,6 +121,6 @@ func NewKarmadaCtlCommand(cmdUse, parentCommand string) *cobra.Command {
return rootCmd return rootCmd
} }
func runHelp(cmd *cobra.Command, args []string) error { func runHelp(cmd *cobra.Command, _ []string) error {
return cmd.Help() return cmd.Help()
} }

View File

@ -280,7 +280,7 @@ func reorganizeTaints(cluster *clusterv1alpha1.Cluster, overwrite bool, taintsTo
// deleteTaints deletes the given taints from the cluster's taintlist. // deleteTaints deletes the given taints from the cluster's taintlist.
func deleteTaints(taintsToRemove []corev1.Taint, newTaints *[]corev1.Taint) ([]error, bool) { func deleteTaints(taintsToRemove []corev1.Taint, newTaints *[]corev1.Taint) ([]error, bool) {
allErrs := []error{} var allErrs []error
var removed bool var removed bool
for i, taintToRemove := range taintsToRemove { for i, taintToRemove := range taintsToRemove {
if len(taintToRemove.Effect) > 0 { if len(taintToRemove.Effect) > 0 {
@ -327,7 +327,7 @@ func checkIfTaintsAlreadyExists(oldTaints []corev1.Taint, taints []corev1.Taint)
// deleteTaintsByKey removes all the taints that have the same key to given taintKey // deleteTaintsByKey removes all the taints that have the same key to given taintKey
func deleteTaintsByKey(taints []corev1.Taint, taintKey string) ([]corev1.Taint, bool) { func deleteTaintsByKey(taints []corev1.Taint, taintKey string) ([]corev1.Taint, bool) {
newTaints := []corev1.Taint{} var newTaints []corev1.Taint
for i := range taints { for i := range taints {
if taintKey == taints[i].Key { if taintKey == taints[i].Key {
continue continue
@ -339,7 +339,7 @@ func deleteTaintsByKey(taints []corev1.Taint, taintKey string) ([]corev1.Taint,
// deleteTaint removes all the taints that have the same key and effect to given taintToDelete. // deleteTaint removes all the taints that have the same key and effect to given taintToDelete.
func deleteTaint(taints []corev1.Taint, taintToDelete *corev1.Taint) ([]corev1.Taint, bool) { func deleteTaint(taints []corev1.Taint, taintToDelete *corev1.Taint) ([]corev1.Taint, bool) {
newTaints := []corev1.Taint{} var newTaints []corev1.Taint
for i := range taints { for i := range taints {
if taintToDelete.MatchTaint(&taints[i]) { if taintToDelete.MatchTaint(&taints[i]) {
continue continue

View File

@ -139,14 +139,14 @@ func TestDeleteTaint(t *testing.T) {
}, },
}, },
taintToDelete: &corev1.Taint{Key: "foo", Effect: corev1.TaintEffectNoSchedule}, taintToDelete: &corev1.Taint{Key: "foo", Effect: corev1.TaintEffectNoSchedule},
expectedTaints: []corev1.Taint{}, expectedTaints: nil,
expectedResult: true, expectedResult: true,
}, },
{ {
name: "delete taint from empty taint array", name: "delete taint from empty taint array",
taints: []corev1.Taint{}, taints: []corev1.Taint{},
taintToDelete: &corev1.Taint{Key: "foo", Effect: corev1.TaintEffectNoSchedule}, taintToDelete: &corev1.Taint{Key: "foo", Effect: corev1.TaintEffectNoSchedule},
expectedTaints: []corev1.Taint{}, expectedTaints: nil,
expectedResult: false, expectedResult: false,
}, },
} }
@ -199,14 +199,14 @@ func TestDeleteTaintByKey(t *testing.T) {
}, },
}, },
taintKey: "foo", taintKey: "foo",
expectedTaints: []corev1.Taint{}, expectedTaints: nil,
expectedResult: true, expectedResult: true,
}, },
{ {
name: "delete taint from empty taint array", name: "delete taint from empty taint array",
taints: []corev1.Taint{}, taints: []corev1.Taint{},
taintKey: "foo", taintKey: "foo",
expectedTaints: []corev1.Taint{}, expectedTaints: nil,
expectedResult: false, expectedResult: false,
}, },
} }
@ -359,7 +359,7 @@ func TestReorganizeTaints(t *testing.T) {
Effect: corev1.TaintEffectNoSchedule, Effect: corev1.TaintEffectNoSchedule,
}, },
}, },
expectedTaints: []corev1.Taint{}, expectedTaints: nil,
expectedOperation: UNTAINTED, expectedOperation: UNTAINTED,
expectedErr: false, expectedErr: false,
}, },
@ -372,7 +372,7 @@ func TestReorganizeTaints(t *testing.T) {
Key: "foo", Key: "foo",
}, },
}, },
expectedTaints: []corev1.Taint{}, expectedTaints: nil,
expectedOperation: UNTAINTED, expectedOperation: UNTAINTED,
expectedErr: false, expectedErr: false,
}, },

View File

@ -185,7 +185,7 @@ func ConvertBootstrapTokenToSecret(bt *BootstrapToken) *corev1.Secret {
Name: bootstraputil.BootstrapTokenSecretName(bt.Token.ID), Name: bootstraputil.BootstrapTokenSecretName(bt.Token.ID),
Namespace: metav1.NamespaceSystem, Namespace: metav1.NamespaceSystem,
}, },
Type: corev1.SecretType(bootstrapapi.SecretTypeBootstrapToken), Type: bootstrapapi.SecretTypeBootstrapToken,
Data: encodeTokenSecretData(bt, time.Now()), Data: encodeTokenSecretData(bt, time.Now()),
} }
} }

View File

@ -29,7 +29,7 @@ func (t *TestFactory) KarmadaClientSet() (versioned.Interface, error) {
} }
// FactoryForMemberCluster returns a cmdutil.Factory for the member cluster // FactoryForMemberCluster returns a cmdutil.Factory for the member cluster
func (t *TestFactory) FactoryForMemberCluster(clusterName string) (cmdutil.Factory, error) { func (t *TestFactory) FactoryForMemberCluster(_ string) (cmdutil.Factory, error) {
// TODO implement me // TODO implement me
panic("implement me") panic("implement me")
} }

View File

@ -63,7 +63,8 @@ type ResourceList map[clusterapis.ResourceName]resource.Quantity
// InitSummary is the init function of modeling data structure // InitSummary is the init function of modeling data structure
func InitSummary(resourceModels []clusterapis.ResourceModel) (ResourceSummary, error) { func InitSummary(resourceModels []clusterapis.ResourceModel) (ResourceSummary, error) {
rsName, rsList := []clusterapis.ResourceName{}, []ResourceList{} var rsName []clusterapis.ResourceName
var rsList []ResourceList
for _, rm := range resourceModels { for _, rm := range resourceModels {
tmp := map[clusterapis.ResourceName]resource.Quantity{} tmp := map[clusterapis.ResourceName]resource.Quantity{}
for _, rmItem := range rm.Ranges { for _, rmItem := range rm.Ranges {
@ -155,7 +156,7 @@ func safeChangeNum(num *int, change int) {
mu.Lock() mu.Lock()
defer mu.Unlock() defer mu.Unlock()
(*num) += change *num += change
} }
// AddToResourceSummary add resource node into modeling summary // AddToResourceSummary add resource node into modeling summary

View File

@ -6,7 +6,7 @@ import (
"reflect" "reflect"
"testing" "testing"
rbt "github.com/emirpasic/gods/trees/redblacktree" "github.com/emirpasic/gods/trees/redblacktree"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
@ -487,7 +487,7 @@ func TestRbtConvertToLl(t *testing.T) {
clusterapis.ResourceMemory: *resource.NewQuantity(1024*12, resource.DecimalSI), clusterapis.ResourceMemory: *resource.NewQuantity(1024*12, resource.DecimalSI),
}, },
} }
tree := rbt.NewWith(clusterResourceNodeComparator) tree := redblacktree.NewWith(clusterResourceNodeComparator)
if actualValue := tree.Size(); actualValue != 0 { if actualValue := tree.Size(); actualValue != 0 {
t.Errorf("Got %v expected %v", actualValue, 0) t.Errorf("Got %v expected %v", actualValue, 0)

View File

@ -24,7 +24,7 @@ import (
// ResourcePrinter is an interface that knows how to print runtime objects. // ResourcePrinter is an interface that knows how to print runtime objects.
type ResourcePrinter interface { type ResourcePrinter interface {
// Print receives a runtime object, formats it and prints it to a writer. // PrintObj receives a runtime object, formats it and prints it to a writer.
PrintObj(runtime.Object, io.Writer) error PrintObj(runtime.Object, io.Writer) error
} }

View File

@ -32,7 +32,7 @@ type TableConvertor struct {
} }
// ConvertToTable method - converts objects to metav1.Table objects using TableGenerator // ConvertToTable method - converts objects to metav1.Table objects using TableGenerator
func (c TableConvertor) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) { func (c TableConvertor) ConvertToTable(_ context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
noHeaders := false noHeaders := false
if tableOptions != nil { if tableOptions != nil {
switch t := tableOptions.(type) { switch t := tableOptions.(type) {

View File

@ -40,11 +40,11 @@ func (obj *TestPrintType) DeepCopyObject() runtime.Object {
return &clone return &clone
} }
func PrintCustomType(obj *TestPrintType, options GenerateOptions) ([]metav1beta1.TableRow, error) { func PrintCustomType(obj *TestPrintType, _ GenerateOptions) ([]metav1beta1.TableRow, error) {
return []metav1beta1.TableRow{{Cells: []interface{}{obj.Data}}}, nil return []metav1beta1.TableRow{{Cells: []interface{}{obj.Data}}}, nil
} }
func ErrorPrintHandler(obj *TestPrintType, options GenerateOptions) ([]metav1beta1.TableRow, error) { func ErrorPrintHandler(_ *TestPrintType, _ GenerateOptions) ([]metav1beta1.TableRow, error) {
return nil, fmt.Errorf("ErrorPrintHandler error") return nil, fmt.Errorf("ErrorPrintHandler error")
} }

View File

@ -118,7 +118,7 @@ func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOp
} }
// Update alters the status subset of an object. // Update alters the status subset of an object.
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) { func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, _ bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because // We are explicitly setting forceAllowCreate to false in the call to the underlying storage because
// subresources should never allow creating on update. // subresources should never allow creating on update.
return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options) return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)

View File

@ -72,7 +72,7 @@ func (Strategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
} }
// PrepareForCreate is invoked on create before validation to normalize the object. // PrepareForCreate is invoked on create before validation to normalize the object.
func (Strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { func (Strategy) PrepareForCreate(_ context.Context, obj runtime.Object) {
cluster := obj.(*clusterapis.Cluster) cluster := obj.(*clusterapis.Cluster)
cluster.Status = clusterapis.ClusterStatus{} cluster.Status = clusterapis.ClusterStatus{}
@ -88,7 +88,7 @@ func (Strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
} }
// PrepareForUpdate is invoked on update before validation to normalize the object. // PrepareForUpdate is invoked on update before validation to normalize the object.
func (Strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { func (Strategy) PrepareForUpdate(_ context.Context, obj, old runtime.Object) {
newCluster := obj.(*clusterapis.Cluster) newCluster := obj.(*clusterapis.Cluster)
oldCluster := old.(*clusterapis.Cluster) oldCluster := old.(*clusterapis.Cluster)
newCluster.Status = oldCluster.Status newCluster.Status = oldCluster.Status
@ -106,13 +106,13 @@ func (Strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
} }
// Validate returns an ErrorList with validation errors or nil. // Validate returns an ErrorList with validation errors or nil.
func (Strategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { func (Strategy) Validate(_ context.Context, obj runtime.Object) field.ErrorList {
cluster := obj.(*clusterapis.Cluster) cluster := obj.(*clusterapis.Cluster)
return validation.ValidateCluster(cluster) return validation.ValidateCluster(cluster)
} }
// WarningsOnCreate returns warnings for the creation of the given object. // WarningsOnCreate returns warnings for the creation of the given object.
func (Strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil } func (Strategy) WarningsOnCreate(_ context.Context, _ runtime.Object) []string { return nil }
// AllowCreateOnUpdate returns true if the object can be created by a PUT. // AllowCreateOnUpdate returns true if the object can be created by a PUT.
func (Strategy) AllowCreateOnUpdate() bool { func (Strategy) AllowCreateOnUpdate() bool {
@ -134,14 +134,14 @@ func (Strategy) Canonicalize(obj runtime.Object) {
// ValidateUpdate is invoked after default fields in the object have been // ValidateUpdate is invoked after default fields in the object have been
// filled in before the object is persisted. // filled in before the object is persisted.
func (Strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { func (Strategy) ValidateUpdate(_ context.Context, obj, old runtime.Object) field.ErrorList {
newCluster := obj.(*clusterapis.Cluster) newCluster := obj.(*clusterapis.Cluster)
oldCluster := old.(*clusterapis.Cluster) oldCluster := old.(*clusterapis.Cluster)
return validation.ValidateClusterUpdate(newCluster, oldCluster) return validation.ValidateClusterUpdate(newCluster, oldCluster)
} }
// WarningsOnUpdate returns warnings for the given update. // WarningsOnUpdate returns warnings for the given update.
func (Strategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { func (Strategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
return nil return nil
} }
@ -162,15 +162,15 @@ func (StatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
} }
// PrepareForUpdate clears fields that are not allowed to be set by end users on update of status // PrepareForUpdate clears fields that are not allowed to be set by end users on update of status
func (StatusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { func (StatusStrategy) PrepareForUpdate(_ context.Context, _, _ runtime.Object) {
} }
// ValidateUpdate is the default update validation for an end user updating status // ValidateUpdate is the default update validation for an end user updating status
func (StatusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { func (StatusStrategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {
return field.ErrorList{} return field.ErrorList{}
} }
// WarningsOnUpdate returns warnings for the given update. // WarningsOnUpdate returns warnings for the given update.
func (StatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { func (StatusStrategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
return nil return nil
} }

View File

@ -31,7 +31,7 @@ type reqResponse struct {
Items []runtime.Object `json:"items"` Items []runtime.Object `json:"items"`
} }
func (r *SearchREST) newCacheHandler(info *genericrequest.RequestInfo, responder rest.Responder) (http.Handler, error) { func (r *SearchREST) newCacheHandler(info *genericrequest.RequestInfo, _ rest.Responder) (http.Handler, error) {
resourceGVR := schema.GroupVersionResource{ resourceGVR := schema.GroupVersionResource{
Group: info.APIGroup, Group: info.APIGroup,
Version: info.APIVersion, Version: info.APIVersion,

View File

@ -7,7 +7,7 @@ import (
"k8s.io/apiserver/pkg/registry/rest" "k8s.io/apiserver/pkg/registry/rest"
) )
func (r *SearchREST) newOpenSearchHandler(info *genericrequest.RequestInfo, responder rest.Responder) (http.Handler, error) { func (r *SearchREST) newOpenSearchHandler(_ *genericrequest.RequestInfo, _ rest.Responder) (http.Handler, error) {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
// Construct a handler and send the request to the ES. // Construct a handler and send the request to the ES.
}), nil }), nil

View File

@ -76,7 +76,7 @@ func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOp
} }
// Update alters the status subset of an object. // Update alters the status subset of an object.
func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) { func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, _ bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
// We are explicitly setting forceAllowCreate to false in the call to the underlying storage because // We are explicitly setting forceAllowCreate to false in the call to the underlying storage because
// subresources should never allow create on update. // subresources should never allow create on update.
return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options) return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)

View File

@ -67,21 +67,21 @@ func (Strategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
} }
// PrepareForCreate is invoked on create before validation to normalize the object. // PrepareForCreate is invoked on create before validation to normalize the object.
func (Strategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { func (Strategy) PrepareForCreate(_ context.Context, _ runtime.Object) {
} }
// PrepareForUpdate is invoked on update before validation to normalize the object. // PrepareForUpdate is invoked on update before validation to normalize the object.
func (Strategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { func (Strategy) PrepareForUpdate(_ context.Context, _, _ runtime.Object) {
} }
// Validate returns an ErrorList with validation errors or nil. // Validate returns an ErrorList with validation errors or nil.
func (Strategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { func (Strategy) Validate(_ context.Context, _ runtime.Object) field.ErrorList {
// TODO: add validation for ResourceRegistry // TODO: add validation for ResourceRegistry
return field.ErrorList{} return field.ErrorList{}
} }
// WarningsOnCreate returns warnings for the creation of the given object. // WarningsOnCreate returns warnings for the creation of the given object.
func (Strategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { return nil } func (Strategy) WarningsOnCreate(_ context.Context, _ runtime.Object) []string { return nil }
// AllowCreateOnUpdate returns true if the object can be created by a PUT. // AllowCreateOnUpdate returns true if the object can be created by a PUT.
func (Strategy) AllowCreateOnUpdate() bool { func (Strategy) AllowCreateOnUpdate() bool {
@ -96,18 +96,18 @@ func (Strategy) AllowUnconditionalUpdate() bool {
} }
// Canonicalize allows an object to be mutated into a canonical form. // Canonicalize allows an object to be mutated into a canonical form.
func (Strategy) Canonicalize(obj runtime.Object) { func (Strategy) Canonicalize(_ runtime.Object) {
} }
// ValidateUpdate is invoked after default fields in the object have been // ValidateUpdate is invoked after default fields in the object have been
// filled in before the object is persisted. // filled in before the object is persisted.
func (Strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { func (Strategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {
// TODO: add validation for ResourceRegistry // TODO: add validation for ResourceRegistry
return field.ErrorList{} return field.ErrorList{}
} }
// WarningsOnUpdate returns warnings for the given update. // WarningsOnUpdate returns warnings for the given update.
func (Strategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { func (Strategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
return nil return nil
} }
@ -128,15 +128,15 @@ func (StatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
} }
// PrepareForUpdate clears fields that are not allowed to be set by end users on update of status // PrepareForUpdate clears fields that are not allowed to be set by end users on update of status
func (StatusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { func (StatusStrategy) PrepareForUpdate(_ context.Context, _, _ runtime.Object) {
} }
// ValidateUpdate is the default update validation for an end user updating status // ValidateUpdate is the default update validation for an end user updating status
func (StatusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { func (StatusStrategy) ValidateUpdate(_ context.Context, _, _ runtime.Object) field.ErrorList {
return field.ErrorList{} return field.ErrorList{}
} }
// WarningsOnUpdate returns warnings for the given update. // WarningsOnUpdate returns warnings for the given update.
func (StatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { func (StatusStrategy) WarningsOnUpdate(_ context.Context, _, _ runtime.Object) []string {
return nil return nil
} }

View File

@ -30,17 +30,18 @@ func NewCache(clusterLister clusterlister.ClusterLister) Cache {
} }
// AddCluster does nothing since clusterLister would synchronize automatically // AddCluster does nothing since clusterLister would synchronize automatically
func (c *schedulerCache) AddCluster(cluster *clusterv1alpha1.Cluster) { func (c *schedulerCache) AddCluster(_ *clusterv1alpha1.Cluster) {
} }
// UpdateCluster does nothing since clusterLister would synchronize automatically // UpdateCluster does nothing since clusterLister would synchronize automatically
func (c *schedulerCache) UpdateCluster(cluster *clusterv1alpha1.Cluster) { func (c *schedulerCache) UpdateCluster(_ *clusterv1alpha1.Cluster) {
} }
// DeleteCluster does nothing since clusterLister would synchronize automatically // DeleteCluster does nothing since clusterLister would synchronize automatically
func (c *schedulerCache) DeleteCluster(cluster *clusterv1alpha1.Cluster) { func (c *schedulerCache) DeleteCluster(_ *clusterv1alpha1.Cluster) {
} }
// Snapshot returns clusters' snapshot.
// TODO: need optimization, only clone when necessary // TODO: need optimization, only clone when necessary
func (c *schedulerCache) Snapshot() Snapshot { func (c *schedulerCache) Snapshot() Snapshot {
out := NewEmptySnapshot() out := NewEmptySnapshot()

View File

@ -62,8 +62,8 @@ func (p *ClusterAffinity) Filter(
} }
// Score calculates the score on the candidate cluster. // Score calculates the score on the candidate cluster.
func (p *ClusterAffinity) Score(ctx context.Context, func (p *ClusterAffinity) Score(_ context.Context,
spec *workv1alpha2.ResourceBindingSpec, cluster *clusterv1alpha1.Cluster) (int64, *framework.Result) { _ *workv1alpha2.ResourceBindingSpec, _ *clusterv1alpha1.Cluster) (int64, *framework.Result) {
return framework.MinClusterScore, framework.NewResult(framework.Success) return framework.MinClusterScore, framework.NewResult(framework.Success)
} }
@ -73,6 +73,6 @@ func (p *ClusterAffinity) ScoreExtensions() framework.ScoreExtensions {
} }
// NormalizeScore normalizes the score for each candidate cluster. // NormalizeScore normalizes the score for each candidate cluster.
func (p *ClusterAffinity) NormalizeScore(ctx context.Context, scores framework.ClusterScoreList) *framework.Result { func (p *ClusterAffinity) NormalizeScore(_ context.Context, _ framework.ClusterScoreList) *framework.Result {
return framework.NewResult(framework.Success) return framework.NewResult(framework.Success)
} }

View File

@ -31,7 +31,7 @@ func (p *ClusterLocality) Name() string {
// Score calculates the score on the candidate cluster. // Score calculates the score on the candidate cluster.
// If the cluster already have the resource(exists in .spec.Clusters of ResourceBinding or ClusterResourceBinding), // If the cluster already have the resource(exists in .spec.Clusters of ResourceBinding or ClusterResourceBinding),
// then score is 100, otherwise 0. // then score is 100, otherwise 0.
func (p *ClusterLocality) Score(ctx context.Context, func (p *ClusterLocality) Score(_ context.Context,
spec *workv1alpha2.ResourceBindingSpec, cluster *clusterv1alpha1.Cluster) (int64, *framework.Result) { spec *workv1alpha2.ResourceBindingSpec, cluster *clusterv1alpha1.Cluster) (int64, *framework.Result) {
if len(spec.Clusters) == 0 { if len(spec.Clusters) == 0 {
return framework.MinClusterScore, framework.NewResult(framework.Success) return framework.MinClusterScore, framework.NewResult(framework.Success)

View File

@ -320,11 +320,11 @@ func (r *mockPlugin) Order() int {
return r.TheOrder return r.TheOrder
} }
func (r *mockPlugin) SupportRequest(request framework.ProxyRequest) bool { func (r *mockPlugin) SupportRequest(_ framework.ProxyRequest) bool {
return r.IsSupportRequest return r.IsSupportRequest
} }
func (r *mockPlugin) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) { func (r *mockPlugin) Connect(_ context.Context, _ framework.ProxyRequest) (http.Handler, error) {
return http.HandlerFunc(func(http.ResponseWriter, *http.Request) { return http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
r.Called = true r.Called = true
}), nil }), nil
@ -446,11 +446,11 @@ func (r *failPlugin) Order() int {
return 0 return 0
} }
func (r *failPlugin) SupportRequest(request framework.ProxyRequest) bool { func (r *failPlugin) SupportRequest(_ framework.ProxyRequest) bool {
return true return true
} }
func (r *failPlugin) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) { func (r *failPlugin) Connect(_ context.Context, _ framework.ProxyRequest) (http.Handler, error) {
return nil, fmt.Errorf("test") return nil, fmt.Errorf("test")
} }

View File

@ -64,7 +64,7 @@ func (c *Cache) SupportRequest(request framework.ProxyRequest) bool {
} }
// Connect implements Plugin // Connect implements Plugin
func (c *Cache) Connect(ctx context.Context, request framework.ProxyRequest) (http.Handler, error) { func (c *Cache) Connect(_ context.Context, request framework.ProxyRequest) (http.Handler, error) {
requestInfo := request.RequestInfo requestInfo := request.RequestInfo
r := &rester{ r := &rester{
store: c.store, store: c.store,

View File

@ -55,7 +55,7 @@ func (p *Karmada) Order() int {
} }
// SupportRequest implements Plugin // SupportRequest implements Plugin
func (p *Karmada) SupportRequest(request framework.ProxyRequest) bool { func (p *Karmada) SupportRequest(_ framework.ProxyRequest) bool {
// This plugin's order is the last one. It's actually a fallback plugin. // This plugin's order is the last one. It's actually a fallback plugin.
// So we return true here to indicate we always support the request. // So we return true here to indicate we always support the request.
return true return true

View File

@ -6,7 +6,7 @@ import (
"github.com/karmada-io/karmada/pkg/search/proxy/framework" "github.com/karmada-io/karmada/pkg/search/proxy/framework"
) )
func emptyPluginFactory(dep PluginDependency) (framework.Plugin, error) { func emptyPluginFactory(_ PluginDependency) (framework.Plugin, error) {
return nil, nil return nil, nil
} }

View File

@ -64,7 +64,7 @@ func NewClusterClientSet(clusterName string, client client.Client, clientOption
} }
// NewClusterClientSetForAgent returns a ClusterClient for the given member cluster which will be used in karmada agent. // NewClusterClientSetForAgent returns a ClusterClient for the given member cluster which will be used in karmada agent.
func NewClusterClientSetForAgent(clusterName string, client client.Client, clientOption *ClientOption) (*ClusterClient, error) { func NewClusterClientSetForAgent(clusterName string, _ client.Client, clientOption *ClientOption) (*ClusterClient, error) {
clusterConfig, err := controllerruntime.GetConfig() clusterConfig, err := controllerruntime.GetConfig()
if err != nil { if err != nil {
return nil, fmt.Errorf("error building kubeconfig of member cluster: %s", err.Error()) return nil, fmt.Errorf("error building kubeconfig of member cluster: %s", err.Error())
@ -97,7 +97,7 @@ func NewClusterDynamicClientSet(clusterName string, client client.Client) (*Dyna
} }
// NewClusterDynamicClientSetForAgent returns a dynamic client for the given member cluster which will be used in karmada agent. // NewClusterDynamicClientSetForAgent returns a dynamic client for the given member cluster which will be used in karmada agent.
func NewClusterDynamicClientSetForAgent(clusterName string, client client.Client) (*DynamicClusterClient, error) { func NewClusterDynamicClientSetForAgent(clusterName string, _ client.Client) (*DynamicClusterClient, error) {
clusterConfig, err := controllerruntime.GetConfig() clusterConfig, err := controllerruntime.GetConfig()
if err != nil { if err != nil {
return nil, fmt.Errorf("error building kubeconfig of member cluster: %s", err.Error()) return nil, fmt.Errorf("error building kubeconfig of member cluster: %s", err.Error())

View File

@ -151,7 +151,7 @@ type asyncWorkerReconciler2 struct {
receivedTimes atomic.Int64 receivedTimes atomic.Int64
} }
func (a *asyncWorkerReconciler2) ReconcileFunc(key QueueKey) error { func (a *asyncWorkerReconciler2) ReconcileFunc(_ QueueKey) error {
a.receivedTimes.Inc() a.receivedTimes.Inc()
return errors.New("always fail") return errors.New("always fail")
} }

View File

@ -22,7 +22,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
// Handle implements admission.Handler interface. // Handle implements admission.Handler interface.
// It yields a response to an AdmissionRequest. // It yields a response to an AdmissionRequest.
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.ClusterOverridePolicy{} policy := &policyv1alpha1.ClusterOverridePolicy{}
err := v.decoder.Decode(req, policy) err := v.decoder.Decode(req, policy)

View File

@ -34,7 +34,7 @@ func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds
} }
// Handle yields a response to an AdmissionRequest. // Handle yields a response to an AdmissionRequest.
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.ClusterPropagationPolicy{} policy := &policyv1alpha1.ClusterPropagationPolicy{}
err := a.decoder.Decode(req, policy) err := a.decoder.Decode(req, policy)

View File

@ -24,7 +24,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
// Handle implements admission.Handler interface. // Handle implements admission.Handler interface.
// It yields a response to an AdmissionRequest. // It yields a response to an AdmissionRequest.
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.ClusterPropagationPolicy{} policy := &policyv1alpha1.ClusterPropagationPolicy{}
err := v.decoder.Decode(req, policy) err := v.decoder.Decode(req, policy)

View File

@ -27,7 +27,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
// Handle implements admission.Handler interface. // Handle implements admission.Handler interface.
// It yields a response to an AdmissionRequest. // It yields a response to an AdmissionRequest.
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
configuration := &configv1alpha1.ResourceInterpreterWebhookConfiguration{} configuration := &configv1alpha1.ResourceInterpreterWebhookConfiguration{}
err := v.decoder.Decode(req, configuration) err := v.decoder.Decode(req, configuration)

View File

@ -27,7 +27,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
// Handle implements admission.Handler interface. // Handle implements admission.Handler interface.
// It yields a response to an AdmissionRequest. // It yields a response to an AdmissionRequest.
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
quota := &policyv1alpha1.FederatedResourceQuota{} quota := &policyv1alpha1.FederatedResourceQuota{}
err := v.decoder.Decode(req, quota) err := v.decoder.Decode(req, quota)

View File

@ -21,7 +21,7 @@ var _ admission.Handler = &MutatingAdmission{}
var _ admission.DecoderInjector = &MutatingAdmission{} var _ admission.DecoderInjector = &MutatingAdmission{}
// Handle yields a response to an AdmissionRequest. // Handle yields a response to an AdmissionRequest.
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.OverridePolicy{} policy := &policyv1alpha1.OverridePolicy{}
err := a.decoder.Decode(req, policy) err := a.decoder.Decode(req, policy)

View File

@ -22,7 +22,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
// Handle implements admission.Handler interface. // Handle implements admission.Handler interface.
// It yields a response to an AdmissionRequest. // It yields a response to an AdmissionRequest.
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.OverridePolicy{} policy := &policyv1alpha1.OverridePolicy{}
err := v.decoder.Decode(req, policy) err := v.decoder.Decode(req, policy)

View File

@ -35,7 +35,7 @@ func NewMutatingHandler(notReadyTolerationSeconds, unreachableTolerationSeconds
} }
// Handle yields a response to an AdmissionRequest. // Handle yields a response to an AdmissionRequest.
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.PropagationPolicy{} policy := &policyv1alpha1.PropagationPolicy{}
err := a.decoder.Decode(req, policy) err := a.decoder.Decode(req, policy)

View File

@ -24,7 +24,7 @@ var _ admission.DecoderInjector = &ValidatingAdmission{}
// Handle implements admission.Handler interface. // Handle implements admission.Handler interface.
// It yields a response to an AdmissionRequest. // It yields a response to an AdmissionRequest.
func (v *ValidatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
policy := &policyv1alpha1.PropagationPolicy{} policy := &policyv1alpha1.PropagationPolicy{}
err := v.decoder.Decode(req, policy) err := v.decoder.Decode(req, policy)

View File

@ -24,7 +24,7 @@ var _ admission.Handler = &MutatingAdmission{}
var _ admission.DecoderInjector = &MutatingAdmission{} var _ admission.DecoderInjector = &MutatingAdmission{}
// Handle yields a response to an AdmissionRequest. // Handle yields a response to an AdmissionRequest.
func (a *MutatingAdmission) Handle(ctx context.Context, req admission.Request) admission.Response { func (a *MutatingAdmission) Handle(_ context.Context, req admission.Request) admission.Response {
work := &workv1alpha1.Work{} work := &workv1alpha1.Work{}
err := a.decoder.Decode(req, work) err := a.decoder.Decode(req, work)