Skip to content

Commit

Permalink
enable golangci-lint: interfacer, staticcheck (kedacore#1158) (kedaco…
Browse files Browse the repository at this point in the history
…re#1267)

Signed-off-by: akartasov <[email protected]>
  • Loading branch information
agneum authored Oct 19, 2020
1 parent 733e92e commit d0788b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ linters:
- unconvert
- ineffassign
- staticcheck
#- interfacer
- interfacer
- scopelint
- structcheck
- deadcode
Expand All @@ -36,7 +36,6 @@ linters:
#- gocritic
#- gocyclo
- gosimple
#- staticcheck
- stylecheck
- unused
- varcheck
Expand All @@ -53,6 +52,7 @@ issues:
linters:
- gomnd
- dupl
- interfacer

# https://github.com/go-critic/go-critic/issues/926
- linters:
Expand Down
4 changes: 2 additions & 2 deletions controllers/util/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// SetStatusConditions patches given object with passed list of conditions based on the object's type or returns an error.
func SetStatusConditions(client runtimeclient.Client, logger logr.Logger, object interface{}, conditions *kedav1alpha1.Conditions) error {
func SetStatusConditions(client runtimeclient.StatusClient, logger logr.Logger, object interface{}, conditions *kedav1alpha1.Conditions) error {
var patch runtimeclient.Patch

runtimeObj := object.(runtime.Object)
Expand All @@ -37,7 +37,7 @@ func SetStatusConditions(client runtimeclient.Client, logger logr.Logger, object
}

// UpdateScaledObjectStatus patches the given ScaledObject with the updated status passed to it or returns an error.
func UpdateScaledObjectStatus(client runtimeclient.Client, logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject, status *kedav1alpha1.ScaledObjectStatus) error {
func UpdateScaledObjectStatus(client runtimeclient.StatusClient, logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject, status *kedav1alpha1.ScaledObjectStatus) error {
patch := runtimeclient.MergeFrom(scaledObject.DeepCopy())
scaledObject.Status = *status
err := client.Status().Patch(context.TODO(), scaledObject, patch)
Expand Down
6 changes: 3 additions & 3 deletions pkg/scaling/scale_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (h *scaleHandler) DeleteScalableObject(scalableObject interface{}) error {
}

// startScaleLoop blocks forever and checks the scaledObject based on its pollingInterval
func (h *scaleHandler) startScaleLoop(ctx context.Context, withTriggers *kedav1alpha1.WithTriggers, scalableObject interface{}, scalingMutex *sync.Mutex) {
func (h *scaleHandler) startScaleLoop(ctx context.Context, withTriggers *kedav1alpha1.WithTriggers, scalableObject interface{}, scalingMutex sync.Locker) {
logger := h.logger.WithValues("type", withTriggers.Kind, "namespace", withTriggers.Namespace, "name", withTriggers.Name)

// kick off one check to the scalers now
Expand All @@ -140,7 +140,7 @@ func (h *scaleHandler) startScaleLoop(ctx context.Context, withTriggers *kedav1a
}
}

func (h *scaleHandler) startPushScalers(ctx context.Context, withTriggers *kedav1alpha1.WithTriggers, scalableObject interface{}, scalingMutex *sync.Mutex) {
func (h *scaleHandler) startPushScalers(ctx context.Context, withTriggers *kedav1alpha1.WithTriggers, scalableObject interface{}, scalingMutex sync.Locker) {
logger := h.logger.WithValues("type", withTriggers.Kind, "namespace", withTriggers.Namespace, "name", withTriggers.Name)
ss, err := h.GetScalers(scalableObject)
if err != nil {
Expand Down Expand Up @@ -178,7 +178,7 @@ func (h *scaleHandler) startPushScalers(ctx context.Context, withTriggers *kedav

// checkScalers contains the main logic for the ScaleHandler scaling logic.
// It'll check each trigger active status then call RequestScale
func (h *scaleHandler) checkScalers(ctx context.Context, scalableObject interface{}, scalingMutex *sync.Mutex) {
func (h *scaleHandler) checkScalers(ctx context.Context, scalableObject interface{}, scalingMutex sync.Locker) {
scalers, err := h.GetScalers(scalableObject)
if err != nil {
h.logger.Error(err, "Error getting scalers", "object", scalableObject)
Expand Down

0 comments on commit d0788b9

Please sign in to comment.