Skip to content

Commit

Permalink
Merge pull request #210 from fmount/golangci-lint-full
Browse files Browse the repository at this point in the history
Move to golangci-lint-full
  • Loading branch information
openshift-merge-bot[bot] authored Apr 24, 2024
2 parents 1db0d39 + 8a41a08 commit 11f4978
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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
4 changes: 2 additions & 2 deletions controllers/swift_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (r *SwiftReconciler) Reconcile(ctx context.Context, req ctrl.Request) (resu

// Handle service delete
if !instance.DeletionTimestamp.IsZero() {
return r.reconcileDelete(ctx, instance, helper)
return r.reconcileDelete(instance, helper)
}

// Handle non-deleted clusters
Expand Down Expand Up @@ -405,7 +405,7 @@ func (r *SwiftReconciler) SetupWithManager(mgr ctrl.Manager) error {
Complete(r)
}

func (r *SwiftReconciler) reconcileDelete(ctx context.Context, instance *swiftv1.Swift, helper *helper.Helper) (ctrl.Result, error) {
func (r *SwiftReconciler) reconcileDelete(instance *swiftv1.Swift, helper *helper.Helper) (ctrl.Result, error) {
r.Log.Info(fmt.Sprintf("Reconciling Service '%s' delete", instance.Name))

// Service is deleted so remove the finalizer.
Expand Down
7 changes: 3 additions & 4 deletions controllers/swiftproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)

// create hash over all the different input resources to identify if any those changed
// and a restart/recreate is required.
inputHash, hashChanged, err := r.createHashOfInputHashes(ctx, instance, envVars)
inputHash, hashChanged, err := r.createHashOfInputHashes(instance, envVars)
if err != nil {
return ctrl.Result{}, err
} else if hashChanged {
Expand Down Expand Up @@ -799,15 +799,15 @@ func (r *SwiftProxyReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *SwiftProxyReconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request {
requests := []reconcile.Request{}

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

for _, field := range swiftProxyWatchFields {
crList := &swiftv1beta1.SwiftProxyList{}
listOps := &client.ListOptions{
FieldSelector: fields.OneTermEqualSelector(field, src.GetName()),
Namespace: src.GetNamespace(),
}
err := r.List(context.TODO(), crList, listOps)
err := r.List(ctx, crList, listOps)
if err != nil {
return []reconcile.Request{}
}
Expand Down Expand Up @@ -877,7 +877,6 @@ func (r *SwiftProxyReconciler) reconcileDelete(ctx context.Context, instance *sw
//
// returns the hash, whether the hash changed (as a bool) and any error
func (r *SwiftProxyReconciler) createHashOfInputHashes(
ctx context.Context,
instance *swiftv1beta1.SwiftProxy,
envVars map[string]env.Setter,
) (string, bool, error) {
Expand Down
3 changes: 1 addition & 2 deletions controllers/swiftstorage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (r *SwiftStorageReconciler) Reconcile(ctx context.Context, req ctrl.Request
}

// Limit internal storage traffic to Swift services
np := swiftstorage.NewNetworkPolicy(swiftstorage.NetworkPolicy(instance, storageNetworkRange), serviceLabels, 5*time.Second)
np := swiftstorage.NewNetworkPolicy(swiftstorage.NetworkPolicy(instance, storageNetworkRange), 5*time.Second)
ctrlResult, err = np.CreateOrPatch(ctx, helper)
if err != nil {
return ctrlResult, err
Expand Down Expand Up @@ -374,7 +374,6 @@ func (r *SwiftStorageReconciler) Reconcile(ctx context.Context, req ctrl.Request
helper,
hostName,
dnsIP,
instance,
swiftPod,
serviceLabels,
)
Expand Down
2 changes: 0 additions & 2 deletions pkg/swiftstorage/dnsdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

infranetworkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
swiftv1 "github.com/openstack-k8s-operators/swift-operator/api/v1beta1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand All @@ -18,7 +17,6 @@ func DNSData(
helper *helper.Helper,
hostName string,
ip string,
instance *swiftv1.SwiftStorage,
swiftPod corev1.Pod,
serviceLabels map[string]string,
) error {
Expand Down
1 change: 0 additions & 1 deletion pkg/swiftstorage/networkpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ type NetworkPolicyStruct struct {
// NewNetworkPolicy returns an initialized NetworkPolicy.
func NewNetworkPolicy(
networkPolicy *networkingv1.NetworkPolicy,
labels map[string]string,
timeout time.Duration,
) *NetworkPolicyStruct {
return &NetworkPolicyStruct{
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ import (
"time"

"github.com/go-logr/logr"
. "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"

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

0 comments on commit 11f4978

Please sign in to comment.