Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure golangci-lint runs on all files #318

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- repo: https://github.com/golangci/golangci-lint
rev: v1.55.2
hooks:
- id: golangci-lint
- id: golangci-lint-full
args: ["-v"]

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
12 changes: 6 additions & 6 deletions controllers/horizon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,15 @@ func (r *HorizonReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *HorizonReconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request {
requests := []reconcile.Request{}

l := log.FromContext(context.Background()).WithName("Controllers").WithName("Horizon")
l := log.FromContext(ctx).WithName("Controllers").WithName("Horizon")

for _, field := range allWatchFields {
crList := &horizonv1beta1.HorizonList{}
listOps := &client.ListOptions{
FieldSelector: fields.OneTermEqualSelector(field, src.GetName()),
Namespace: src.GetNamespace(),
}
err := r.Client.List(context.TODO(), crList, listOps)
err := r.Client.List(ctx, crList, listOps)
if err != nil {
return []reconcile.Request{}
}
Expand Down Expand Up @@ -460,7 +460,7 @@ func (r *HorizonReconciler) reconcileInit(
return ctrl.Result{}, nil
}

func (r *HorizonReconciler) reconcileUpdate(ctx context.Context, instance *horizonv1beta1.Horizon, helper *helper.Helper) (ctrl.Result, error) {
func (r *HorizonReconciler) reconcileUpdate(ctx context.Context) (ctrl.Result, error) {
Log := r.GetLogger(ctx)
Log.Info("Reconciling Service update")

Expand All @@ -471,7 +471,7 @@ func (r *HorizonReconciler) reconcileUpdate(ctx context.Context, instance *horiz
return ctrl.Result{}, nil
}

func (r *HorizonReconciler) reconcileUpgrade(ctx context.Context, instance *horizonv1beta1.Horizon, helper *helper.Helper) (ctrl.Result, error) {
func (r *HorizonReconciler) reconcileUpgrade(ctx context.Context) (ctrl.Result, error) {
Log := r.GetLogger(ctx)
Log.Info("Reconciling Service upgrade")

Expand Down Expand Up @@ -666,13 +666,13 @@ func (r *HorizonReconciler) reconcileNormal(ctx context.Context, instance *horiz
}

// Handle service update
ctrlResult, err = r.reconcileUpdate(ctx, instance, helper)
ctrlResult, err = r.reconcileUpdate(ctx)
if err != nil || (ctrlResult != ctrl.Result{}) {
return ctrlResult, err
}

// Handle service upgrade
ctrlResult, err = r.reconcileUpgrade(ctx, instance, helper)
ctrlResult, err = r.reconcileUpgrade(ctx)
if err != nil || (ctrlResult != ctrl.Result{}) {
return ctrlResult, err
}
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package functional_test

import (
"github.com/onsi/gomega"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega" //revive:disable:dot-imports
"sigs.k8s.io/controller-runtime/pkg/client"

corev1 "k8s.io/api/core/v1"
Expand Down
12 changes: 7 additions & 5 deletions tests/functional/horizon_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import (
"fmt"
"os"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //revive:disable:dot-imports
. "github.com/onsi/gomega" //revive:disable:dot-imports

//revive:disable-next-line:dot-imports
. "github.com/openstack-k8s-operators/lib-common/modules/common/test/helpers"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/ptr"

"github.com/openstack-k8s-operators/horizon-operator/pkg/horizon"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
. "github.com/openstack-k8s-operators/lib-common/modules/common/test/helpers"

memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
)

var _ = Describe("Horizon controller", func() {
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/horizon_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package functional_test
import (
"os"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //revive:disable:dot-imports
. "github.com/onsi/gomega" //revive:disable:dot-imports
"k8s.io/apimachinery/pkg/types"

horizonv1 "github.com/openstack-k8s-operators/horizon-operator/api/v1beta1"
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

"github.com/go-logr/logr"
"github.com/google/uuid"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //revive:disable:dot-imports
. "github.com/onsi/gomega" //revive:disable:dot-imports

"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
Expand Down
Loading