Merge pull request #4495 from jwcesign/BlankImports
cleanup: enable revive(blank-imports/indent-error-flow rule) checking
This commit is contained in:
commit
bef4e7aa60
|
@ -80,6 +80,8 @@ linters-settings:
|
||||||
- name: errorf
|
- name: errorf
|
||||||
- name: exported
|
- name: exported
|
||||||
- name: var-declaration
|
- name: var-declaration
|
||||||
|
- name: blank-imports
|
||||||
|
- name: indent-error-flow
|
||||||
staticcheck:
|
staticcheck:
|
||||||
checks:
|
checks:
|
||||||
- all
|
- all
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"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"
|
"github.com/go-co-op/gocron"
|
||||||
autoscalingv2 "k8s.io/api/autoscaling/v2"
|
autoscalingv2 "k8s.io/api/autoscaling/v2"
|
||||||
|
|
|
@ -229,9 +229,8 @@ func (i *CommandInitOption) Validate(parentCommand string) error {
|
||||||
|
|
||||||
if i.isExternalEtcdProvided() {
|
if i.isExternalEtcdProvided() {
|
||||||
return i.validateExternalEtcd(parentCommand)
|
return i.validateExternalEtcd(parentCommand)
|
||||||
} else {
|
|
||||||
return i.validateLocalEtcd(parentCommand)
|
|
||||||
}
|
}
|
||||||
|
return i.validateLocalEtcd(parentCommand)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete Initialize k8s client
|
// Complete Initialize k8s client
|
||||||
|
|
|
@ -334,8 +334,7 @@ func checkPodAge(pod *corev1.Pod) error {
|
||||||
if age > metricsCreationDelay {
|
if age > metricsCreationDelay {
|
||||||
message := fmt.Sprintf("Metrics not available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
|
message := fmt.Sprintf("Metrics not available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
|
||||||
return errors.New(message)
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,9 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
_ "time/tzdata"
|
_ "time/tzdata" // import tzdata to support time zone parsing, this is needed by function time.LoadLocation
|
||||||
|
|
||||||
"github.com/adhocore/gronx"
|
"github.com/adhocore/gronx"
|
||||||
apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
|
|
||||||
apivalidation "k8s.io/apimachinery/pkg/api/validation"
|
apivalidation "k8s.io/apimachinery/pkg/api/validation"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"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)
|
klog.V(2).Infof("Validating CronFederatedHPA(%s) for request: %s", klog.KObj(cronFHPA).String(), req.Operation)
|
||||||
|
|
||||||
errs := field.ErrorList{}
|
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"))...)
|
errs = append(errs, validateCronFederatedHPASpec(&cronFHPA.Spec, field.NewPath("spec"))...)
|
||||||
|
|
||||||
if len(errs) != 0 {
|
if len(errs) != 0 {
|
||||||
|
|
Loading…
Reference in New Issue