From 00d3951c36a086c3c8f2e1180cfca105b48a14b2 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Thu, 2 Jul 2020 17:55:14 +0100 Subject: [PATCH] chore: Fix golangci-lint issues --- pkg/controller/kubefedcluster/clusterclient.go | 2 +- pkg/controller/kubefedcluster/controller.go | 3 +-- pkg/controller/schedulingpreference/controller.go | 4 ++-- pkg/controller/sync/version/manager.go | 5 +---- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/controller/kubefedcluster/clusterclient.go b/pkg/controller/kubefedcluster/clusterclient.go index 3fc98deeb6..7fcac91995 100644 --- a/pkg/controller/kubefedcluster/clusterclient.go +++ b/pkg/controller/kubefedcluster/clusterclient.go @@ -71,7 +71,7 @@ func NewClusterClientSet(c *fedv1b1.KubeFedCluster, client generic.Client, fedNa if err != nil { return nil, err } - clusterConfig.Timeout = timeout + clusterConfig.Timeout = timeout //nolint:staticcheck var clusterClientSet = ClusterClient{clusterName: c.Name} if clusterConfig != nil { clusterClientSet.kubeClient = kubeclientset.NewForConfigOrDie((restclient.AddUserAgent(clusterConfig, UserAgentName))) diff --git a/pkg/controller/kubefedcluster/controller.go b/pkg/controller/kubefedcluster/controller.go index e61c42ccbb..9a56ffe9fd 100644 --- a/pkg/controller/kubefedcluster/controller.go +++ b/pkg/controller/kubefedcluster/controller.go @@ -18,7 +18,6 @@ package kubefedcluster import ( "context" - "fmt" "sync" "time" @@ -111,7 +110,7 @@ func newClusterController(config *util.ControllerConfig, clusterHealthCheckConfi kubeClient := kubeclient.NewForConfigOrDie(kubeConfig) broadcaster := record.NewBroadcaster() broadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(genscheme.Scheme, corev1.EventSource{Component: fmt.Sprintf("kubefedcluster-controller")}) + recorder := broadcaster.NewRecorder(genscheme.Scheme, corev1.EventSource{Component: "kubefedcluster-controller"}) cc.eventRecorder = recorder var err error diff --git a/pkg/controller/schedulingpreference/controller.go b/pkg/controller/schedulingpreference/controller.go index 820870b257..a8a5675e7e 100644 --- a/pkg/controller/schedulingpreference/controller.go +++ b/pkg/controller/schedulingpreference/controller.go @@ -78,7 +78,7 @@ func StartSchedulingPreferenceController(config *util.ControllerConfig, scheduli if config.MinimizeLatency { controller.minimizeLatency() } - klog.Infof(fmt.Sprintf("Starting replicaschedulingpreferences controller")) + klog.Infof("Starting replicaschedulingpreferences controller") controller.Run(stopChannel) return controller.scheduler, nil } @@ -95,7 +95,7 @@ func newSchedulingPreferenceController(config *util.ControllerConfig, scheduling broadcaster := record.NewBroadcaster() broadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) - recorder := broadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: fmt.Sprintf("replicaschedulingpreference-controller")}) + recorder := broadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "replicaschedulingpreference-controller"}) s := &SchedulingPreferenceController{ clusterAvailableDelay: config.ClusterAvailableDelay, diff --git a/pkg/controller/sync/version/manager.go b/pkg/controller/sync/version/manager.go index bef5f37483..595953b760 100644 --- a/pkg/controller/sync/version/manager.go +++ b/pkg/controller/sync/version/manager.go @@ -88,10 +88,7 @@ func (m *VersionManager) Sync(stopChan <-chan struct{}) { if !ok { return } - ok = m.load(versionList, stopChan) - if !ok { - return - } + m.load(versionList, stopChan) } // HasSynced indicates whether the manager's in-memory state has been