Skip to content

Commit ec0ec16

Browse files
committed
Fix linting issues
Signed-off-by: Borja Clemente <[email protected]>
1 parent 4bea0b5 commit ec0ec16

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

pkg/cluster/cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ var _ = Describe("cluster.Cluster", func() {
158158
It("should provide a function to get the EventRecorder", func() {
159159
c, err := New(cfg)
160160
Expect(err).NotTo(HaveOccurred())
161-
Expect(c.GetEventRecorderFor("test")).NotTo(BeNil())
161+
Expect(c.GetEventRecorderFor("test")).NotTo(BeNil()) //nolint:staticcheck
162162
})
163163
It("should provide a function to get the APIReader", func() {
164164
c, err := New(cfg)

pkg/internal/recorder/recorder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (p *Provider) getBroadcaster() events.EventBroadcaster {
9595
p.broadcaster = events.NewBroadcaster(&events.EventSinkImpl{Interface: p.evtClient})
9696
}
9797
// TODO(clebs): figure out how to manage the context/channel that StartRecordingToSink needs inside the provider.
98-
p.broadcaster.StartRecordingToSinkWithContext(context.TODO())
98+
_ = p.broadcaster.StartRecordingToSinkWithContext(context.TODO())
9999
})
100100

101101
return p.broadcaster

pkg/internal/recorder/recorder_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var _ = Describe("recorder", func() {
4343
Expect(err).NotTo(HaveOccurred())
4444

4545
By("Creating the Controller")
46-
recorder := cm.GetEventRecorderFor("test-recorder")
46+
recorder := cm.GetEventRecorderFor("test-recorder") //nolint:staticcheck
4747
instance, err := controller.New("foo-controller", cm, controller.Options{
4848
Reconciler: reconcile.Func(
4949
func(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {

pkg/leaderelection/leader_election.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func NewResourceLock(config *rest.Config, recorderProvider recorder.Provider, op
128128
coordinationClient,
129129
resourcelock.ResourceLockConfig{
130130
Identity: id,
131-
EventRecorder: recorderProvider.GetEventRecorderFor(id),
131+
EventRecorder: recorderProvider.GetEventRecorderFor(id), //nolint:staticcheck
132132
},
133133
options.LeaderLabels,
134134
)

pkg/manager/internal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (cm *controllerManager) GetCache() cache.Cache {
257257
}
258258

259259
func (cm *controllerManager) GetEventRecorderFor(name string) record.EventRecorder {
260-
return cm.cluster.GetEventRecorderFor(name)
260+
return cm.cluster.GetEventRecorderFor(name) //nolint:staticcheck
261261
}
262262

263263
func (cm *controllerManager) GetEventRecorder(name string) events.EventRecorder {

pkg/manager/manager.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,7 @@ func New(config *rest.Config, options Options) (Manager, error) {
331331
return nil, errors.New("must specify Config")
332332
}
333333
// Set default values for options fields
334-
options, err := setOptionsDefaults(config, options)
335-
if err != nil {
336-
return nil, err
337-
}
334+
options = setOptionsDefaults(config, options)
338335

339336
cluster, err := cluster.New(config, func(clusterOptions *cluster.Options) {
340337
clusterOptions.Scheme = options.Scheme
@@ -490,7 +487,7 @@ func defaultBaseContext() context.Context {
490487
}
491488

492489
// setOptionsDefaults set default values for Options fields.
493-
func setOptionsDefaults(config *rest.Config, options Options) (Options, error) {
490+
func setOptionsDefaults(_ *rest.Config, options Options) Options {
494491
// Allow newResourceLock to be mocked
495492
if options.newResourceLock == nil {
496493
options.newResourceLock = leaderelection.NewResourceLock
@@ -554,5 +551,5 @@ func setOptionsDefaults(config *rest.Config, options Options) (Options, error) {
554551
options.WebhookServer = webhook.NewServer(webhook.Options{})
555552
}
556553

557-
return options, nil
554+
return options
558555
}

pkg/manager/manager_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ var _ = Describe("manger.Manager", func() {
18151815
ns := corev1.Namespace{}
18161816
ns.Name = "default"
18171817

1818-
recorder := m.GetEventRecorderFor("rock-and-roll")
1818+
recorder := m.GetEventRecorderFor("rock-and-roll") //nolint:staticcheck
18191819
Expect(m.Add(RunnableFunc(func(_ context.Context) error {
18201820
recorder.Event(&ns, "Warning", "BallroomBlitz", "yeah, yeah, yeah-yeah-yeah")
18211821
return nil
@@ -1936,7 +1936,7 @@ var _ = Describe("manger.Manager", func() {
19361936
It("should provide a function to get the EventRecorder", func() {
19371937
m, err := New(cfg, Options{})
19381938
Expect(err).NotTo(HaveOccurred())
1939-
Expect(m.GetEventRecorderFor("test")).NotTo(BeNil())
1939+
Expect(m.GetEventRecorderFor("test")).NotTo(BeNil()) //nolint:staticcheck
19401940
})
19411941
It("should provide a function to get the APIReader", func() {
19421942
m, err := New(cfg, Options{})

0 commit comments

Comments
 (0)