Skip to content

Commit

Permalink
Merge pull request #4495 from jwcesign/BlankImports
Browse files Browse the repository at this point in the history
cleanup: enable revive(blank-imports/indent-error-flow rule) checking
  • Loading branch information
karmada-bot committed Jan 10, 2024
2 parents a19febf + e36a80c commit bef4e7a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ linters-settings:
- name: errorf
- name: exported
- name: var-declaration
- name: blank-imports
- name: indent-error-flow
staticcheck:
checks:
- all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions pkg/karmadactl/cmdinit/kubernetes/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions pkg/karmadactl/top/top_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 2 additions & 3 deletions pkg/webhook/cronfederatedhpa/validating.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit bef4e7a

Please sign in to comment.