Skip to content

Commit e36a80c

Browse files
committed
cleanup: enable revive(blank-imports rule) checking
Signed-off-by: jwcesign <[email protected]>
1 parent 43c3e33 commit e36a80c

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ linters-settings:
8080
- name: errorf
8181
- name: exported
8282
- name: var-declaration
83+
- name: blank-imports
84+
- name: indent-error-flow
8385
staticcheck:
8486
checks:
8587
- all

pkg/controllers/cronfederatedhpa/cronfederatedhpa_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"fmt"
1818
"sync"
1919
"time"
20-
_ "time/tzdata"
20+
_ "time/tzdata" // import tzdata to support time zone parsing, this is needed by function time.LoadLocation
2121

2222
"github.com/go-co-op/gocron"
2323
autoscalingv2 "k8s.io/api/autoscaling/v2"

pkg/karmadactl/cmdinit/kubernetes/deploy.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,8 @@ func (i *CommandInitOption) Validate(parentCommand string) error {
229229

230230
if i.isExternalEtcdProvided() {
231231
return i.validateExternalEtcd(parentCommand)
232-
} else {
233-
return i.validateLocalEtcd(parentCommand)
234232
}
233+
return i.validateLocalEtcd(parentCommand)
235234
}
236235

237236
// Complete Initialize k8s client

pkg/karmadactl/top/top_pods.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ func checkPodAge(pod *corev1.Pod) error {
334334
if age > metricsCreationDelay {
335335
message := fmt.Sprintf("Metrics not available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
336336
return errors.New(message)
337-
} else {
338-
klog.V(2).Infof("Metrics not yet available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
339-
return nil
340337
}
338+
klog.V(2).Infof("Metrics not yet available for pod %s/%s, age: %s", pod.Namespace, pod.Name, age.String())
339+
return nil
341340
}

pkg/webhook/cronfederatedhpa/validating.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ import (
1919
"math"
2020
"net/http"
2121
"time"
22-
_ "time/tzdata"
22+
_ "time/tzdata" // import tzdata to support time zone parsing, this is needed by function time.LoadLocation
2323

2424
"github.com/adhocore/gronx"
25-
apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
2625
apivalidation "k8s.io/apimachinery/pkg/api/validation"
2726
"k8s.io/apimachinery/pkg/util/sets"
2827
"k8s.io/apimachinery/pkg/util/validation/field"
@@ -54,7 +53,7 @@ func (v *ValidatingAdmission) Handle(_ context.Context, req admission.Request) a
5453
klog.V(2).Infof("Validating CronFederatedHPA(%s) for request: %s", klog.KObj(cronFHPA).String(), req.Operation)
5554

5655
errs := field.ErrorList{}
57-
errs = append(errs, apimachineryvalidation.ValidateObjectMeta(&cronFHPA.ObjectMeta, true, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
56+
errs = append(errs, apivalidation.ValidateObjectMeta(&cronFHPA.ObjectMeta, true, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
5857
errs = append(errs, validateCronFederatedHPASpec(&cronFHPA.Spec, field.NewPath("spec"))...)
5958

6059
if len(errs) != 0 {

0 commit comments

Comments
 (0)