Merge pull request #4495 from jwcesign/BlankImports

cleanup: enable revive(blank-imports/indent-error-flow rule) checking
This commit is contained in:
karmada-bot 2024-01-10 11:45:33 +08:00 committed by GitHub
commit bef4e7aa60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 9 deletions

View File

@ -80,6 +80,8 @@ linters-settings:
- name: errorf
- name: exported
- name: var-declaration
- name: blank-imports
- name: indent-error-flow
staticcheck:
checks:
- all

View File

@ -17,7 +17,7 @@ import (
"fmt"
"sync"
"time"
_ "time/tzdata"
_ "time/tzdata" // import tzdata to support time zone parsing, this is needed by function time.LoadLocation
"github.com/go-co-op/gocron"
autoscalingv2 "k8s.io/api/autoscaling/v2"

View File

@ -229,9 +229,8 @@ func (i *CommandInitOption) Validate(parentCommand string) error {
if i.isExternalEtcdProvided() {
return i.validateExternalEtcd(parentCommand)
} else {
return i.validateLocalEtcd(parentCommand)
}
return i.validateLocalEtcd(parentCommand)
}
// Complete Initialize k8s client

View File

@ -334,8 +334,7 @@ func checkPodAge(pod *corev1.Pod) error {
if age > metricsCreationDelay {
message := fmt.Sprintf("Metrics not available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
return errors.New(message)
} else {
klog.V(2).Infof("Metrics not yet available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
return nil
}
klog.V(2).Infof("Metrics not yet available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
return nil
}

View File

@ -19,10 +19,9 @@ import (
"math"
"net/http"
"time"
_ "time/tzdata"
_ "time/tzdata" // import tzdata to support time zone parsing, this is needed by function time.LoadLocation
"github.com/adhocore/gronx"
apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
apivalidation "k8s.io/apimachinery/pkg/api/validation"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation/field"
@ -54,7 +53,7 @@ func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) a
klog.V(2).Infof("Validating CronFederatedHPA(%s) for request: %s", klog.KObj(cronFHPA).String(), req.Operation)
errs := field.ErrorList{}
errs = append(errs, apimachineryvalidation.ValidateObjectMeta(&cronFHPA.ObjectMeta, true, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
errs = append(errs, apivalidation.ValidateObjectMeta(&cronFHPA.ObjectMeta, true, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
errs = append(errs, validateCronFederatedHPASpec(&cronFHPA.Spec, field.NewPath("spec"))...)
if len(errs) != 0 {