Skip to content

Commit af6b57a

Browse files
committed
Fix a few more linter warnings
1 parent 7072c9a commit af6b57a

File tree

5 files changed

+48
-48
lines changed

5 files changed

+48
-48
lines changed

pkg/apply/applier.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (a *Applier) Run(ctx context.Context, invInfo inventory.Info, objects objec
179179
Build(taskContext, opts)
180180

181181
klog.V(4).Infof("validation errors: %d", len(vCollector.Errors))
182-
klog.V(4).Infof("invalid objects: %d", len(vCollector.InvalidIds))
182+
klog.V(4).Infof("invalid objects: %d", len(vCollector.InvalidIDs))
183183

184184
// Handle validation errors
185185
switch options.ValidationPolicy {
@@ -199,7 +199,7 @@ func (a *Applier) Run(ctx context.Context, invInfo inventory.Info, objects objec
199199
}
200200

201201
// Register invalid objects to be retained in the inventory, if present.
202-
for _, id := range vCollector.InvalidIds {
202+
for _, id := range vCollector.InvalidIDs {
203203
taskContext.AddInvalidObject(id)
204204
}
205205

pkg/apply/destroyer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (d *Destroyer) Run(ctx context.Context, invInfo inventory.Info, options Des
142142
Build(taskContext, opts)
143143

144144
klog.V(4).Infof("validation errors: %d", len(vCollector.Errors))
145-
klog.V(4).Infof("invalid objects: %d", len(vCollector.InvalidIds))
145+
klog.V(4).Infof("invalid objects: %d", len(vCollector.InvalidIDs))
146146

147147
// Handle validation errors
148148
switch options.ValidationPolicy {
@@ -162,7 +162,7 @@ func (d *Destroyer) Run(ctx context.Context, invInfo inventory.Info, options Des
162162
}
163163

164164
// Register invalid objects to be retained in the inventory, if present.
165-
for _, id := range vCollector.InvalidIds {
165+
for _, id := range vCollector.InvalidIDs {
166166
taskContext.AddInvalidObject(id)
167167
}
168168

pkg/apply/solver/solver_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
178178
},
179179
&taskrunner.WaitTask{
180180
TaskName: "wait-0",
181-
Ids: object.ObjMetadataSet{
181+
IDs: object.ObjMetadataSet{
182182
testutil.ToIdentifier(t, resources["deployment"]),
183183
},
184184
Condition: taskrunner.AllCurrent,
@@ -228,7 +228,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
228228
},
229229
&taskrunner.WaitTask{
230230
TaskName: "wait-0",
231-
Ids: object.ObjMetadataSet{
231+
IDs: object.ObjMetadataSet{
232232
testutil.ToIdentifier(t, resources["deployment"]),
233233
testutil.ToIdentifier(t, resources["secret"]),
234234
},
@@ -291,7 +291,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
291291
},
292292
&taskrunner.WaitTask{
293293
TaskName: "wait-0",
294-
Ids: object.ObjMetadataSet{
294+
IDs: object.ObjMetadataSet{
295295
testutil.ToIdentifier(t, resources["secret"]),
296296
testutil.ToIdentifier(t, resources["deployment"]),
297297
},
@@ -471,7 +471,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
471471
},
472472
&taskrunner.WaitTask{
473473
TaskName: "wait-0",
474-
Ids: object.ObjMetadataSet{
474+
IDs: object.ObjMetadataSet{
475475
testutil.ToIdentifier(t, resources["crd"]),
476476
},
477477
Condition: taskrunner.AllCurrent,
@@ -486,7 +486,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
486486
},
487487
&taskrunner.WaitTask{
488488
TaskName: "wait-1",
489-
Ids: object.ObjMetadataSet{
489+
IDs: object.ObjMetadataSet{
490490
testutil.ToIdentifier(t, resources["crontab1"]),
491491
testutil.ToIdentifier(t, resources["crontab2"]),
492492
},
@@ -632,7 +632,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
632632
},
633633
&taskrunner.WaitTask{
634634
TaskName: "wait-0",
635-
Ids: object.ObjMetadataSet{
635+
IDs: object.ObjMetadataSet{
636636
testutil.ToIdentifier(t, resources["namespace"]),
637637
},
638638
Condition: taskrunner.AllCurrent,
@@ -647,7 +647,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
647647
},
648648
&taskrunner.WaitTask{
649649
TaskName: "wait-1",
650-
Ids: object.ObjMetadataSet{
650+
IDs: object.ObjMetadataSet{
651651
testutil.ToIdentifier(t, resources["secret"]),
652652
testutil.ToIdentifier(t, resources["pod"]),
653653
},
@@ -717,7 +717,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
717717
},
718718
&taskrunner.WaitTask{
719719
TaskName: "wait-0",
720-
Ids: object.ObjMetadataSet{
720+
IDs: object.ObjMetadataSet{
721721
testutil.ToIdentifier(t, resources["secret"]),
722722
},
723723
Condition: taskrunner.AllCurrent,
@@ -732,7 +732,7 @@ func TestTaskQueueBuilder_ApplyBuild(t *testing.T) {
732732
},
733733
&taskrunner.WaitTask{
734734
TaskName: "wait-1",
735-
Ids: object.ObjMetadataSet{
735+
IDs: object.ObjMetadataSet{
736736
testutil.ToIdentifier(t, resources["deployment"]),
737737
},
738738
Condition: taskrunner.AllCurrent,
@@ -892,7 +892,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
892892
},
893893
&taskrunner.WaitTask{
894894
TaskName: "wait-0",
895-
Ids: object.ObjMetadataSet{
895+
IDs: object.ObjMetadataSet{
896896
testutil.ToIdentifier(t, resources["default-pod"]),
897897
},
898898
Condition: taskrunner.AllNotFound,
@@ -939,7 +939,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
939939
},
940940
&taskrunner.WaitTask{
941941
TaskName: "wait-0",
942-
Ids: object.ObjMetadataSet{
942+
IDs: object.ObjMetadataSet{
943943
testutil.ToIdentifier(t, resources["default-pod"]),
944944
testutil.ToIdentifier(t, resources["pod"]),
945945
},
@@ -998,7 +998,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
998998
},
999999
&taskrunner.WaitTask{
10001000
TaskName: "wait-0",
1001-
Ids: object.ObjMetadataSet{
1001+
IDs: object.ObjMetadataSet{
10021002
testutil.ToIdentifier(t, resources["pod"]),
10031003
},
10041004
Condition: taskrunner.AllNotFound,
@@ -1011,7 +1011,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
10111011
},
10121012
&taskrunner.WaitTask{
10131013
TaskName: "wait-1",
1014-
Ids: object.ObjMetadataSet{
1014+
IDs: object.ObjMetadataSet{
10151015
testutil.ToIdentifier(t, resources["secret"]),
10161016
},
10171017
Condition: taskrunner.AllNotFound,
@@ -1068,7 +1068,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
10681068
},
10691069
&taskrunner.WaitTask{
10701070
TaskName: "wait-0",
1071-
Ids: object.ObjMetadataSet{
1071+
IDs: object.ObjMetadataSet{
10721072
testutil.ToIdentifier(t, resources["pod"]),
10731073
},
10741074
Condition: taskrunner.AllNotFound,
@@ -1175,7 +1175,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
11751175
},
11761176
&taskrunner.WaitTask{
11771177
TaskName: "wait-0",
1178-
Ids: object.ObjMetadataSet{
1178+
IDs: object.ObjMetadataSet{
11791179
testutil.ToIdentifier(t, resources["crontab1"]),
11801180
testutil.ToIdentifier(t, resources["crontab2"]),
11811181
},
@@ -1189,7 +1189,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
11891189
},
11901190
&taskrunner.WaitTask{
11911191
TaskName: "wait-1",
1192-
Ids: object.ObjMetadataSet{
1192+
IDs: object.ObjMetadataSet{
11931193
testutil.ToIdentifier(t, resources["crd"]),
11941194
},
11951195
Condition: taskrunner.AllNotFound,
@@ -1328,7 +1328,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
13281328
},
13291329
&taskrunner.WaitTask{
13301330
TaskName: "wait-0",
1331-
Ids: object.ObjMetadataSet{
1331+
IDs: object.ObjMetadataSet{
13321332
testutil.ToIdentifier(t, resources["pod"]),
13331333
testutil.ToIdentifier(t, resources["secret"]),
13341334
},
@@ -1342,7 +1342,7 @@ func TestTaskQueueBuilder_PruneBuild(t *testing.T) {
13421342
},
13431343
&taskrunner.WaitTask{
13441344
TaskName: "wait-1",
1345-
Ids: object.ObjMetadataSet{
1345+
IDs: object.ObjMetadataSet{
13461346
testutil.ToIdentifier(t, resources["namespace"]),
13471347
},
13481348
Condition: taskrunner.AllNotFound,
@@ -1560,7 +1560,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
15601560
},
15611561
&taskrunner.WaitTask{
15621562
TaskName: "wait-0",
1563-
Ids: object.ObjMetadataSet{
1563+
IDs: object.ObjMetadataSet{
15641564
testutil.ToIdentifier(t, resources["deployment"]),
15651565
},
15661566
Condition: taskrunner.AllCurrent,
@@ -1573,7 +1573,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
15731573
},
15741574
&taskrunner.WaitTask{
15751575
TaskName: "wait-1",
1576-
Ids: object.ObjMetadataSet{
1576+
IDs: object.ObjMetadataSet{
15771577
testutil.ToIdentifier(t, resources["secret"]),
15781578
},
15791579
Condition: taskrunner.AllNotFound,
@@ -1634,7 +1634,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
16341634
},
16351635
&taskrunner.WaitTask{
16361636
TaskName: "wait-0",
1637-
Ids: object.ObjMetadataSet{
1637+
IDs: object.ObjMetadataSet{
16381638
testutil.ToIdentifier(t, resources["deployment"]),
16391639
},
16401640
Condition: taskrunner.AllCurrent,
@@ -1695,7 +1695,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
16951695
},
16961696
&taskrunner.WaitTask{
16971697
TaskName: "wait-0",
1698-
Ids: object.ObjMetadataSet{
1698+
IDs: object.ObjMetadataSet{
16991699
testutil.ToIdentifier(t, resources["deployment"]),
17001700
},
17011701
Condition: taskrunner.AllCurrent,
@@ -1708,7 +1708,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
17081708
},
17091709
&taskrunner.WaitTask{
17101710
TaskName: "wait-1",
1711-
Ids: object.ObjMetadataSet{
1711+
IDs: object.ObjMetadataSet{
17121712
testutil.ToIdentifier(t, resources["secret"]),
17131713
},
17141714
Condition: taskrunner.AllNotFound,
@@ -1774,7 +1774,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
17741774
},
17751775
&taskrunner.WaitTask{
17761776
TaskName: "wait-0",
1777-
Ids: object.ObjMetadataSet{
1777+
IDs: object.ObjMetadataSet{
17781778
testutil.ToIdentifier(t, resources["deployment"]),
17791779
},
17801780
Condition: taskrunner.AllCurrent,
@@ -1788,7 +1788,7 @@ func TestTaskQueueBuilder_ApplyPruneBuild(t *testing.T) {
17881788
},
17891789
&taskrunner.WaitTask{
17901790
TaskName: "wait-1",
1791-
Ids: object.ObjMetadataSet{
1791+
IDs: object.ObjMetadataSet{
17921792
testutil.ToIdentifier(t, resources["secret"]),
17931793
},
17941794
Condition: taskrunner.AllNotFound,
@@ -1879,7 +1879,7 @@ func waitTaskComparer() cmp.Option {
18791879
return false
18801880
}
18811881
return x.TaskName == y.TaskName &&
1882-
x.Ids.Hash() == y.Ids.Hash() && // exact order match
1882+
x.IDs.Hash() == y.IDs.Hash() && // exact order match
18831883
x.Condition == y.Condition &&
18841884
x.Timeout == y.Timeout &&
18851885
cmp.Equal(x.Mapper, y.Mapper)

pkg/apply/taskrunner/task.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Task interface {
3838
func NewWaitTask(name string, ids object.ObjMetadataSet, cond Condition, timeout time.Duration, mapper meta.RESTMapper) *WaitTask {
3939
return &WaitTask{
4040
TaskName: name,
41-
Ids: ids,
41+
IDs: ids,
4242
Condition: cond,
4343
Timeout: timeout,
4444
Mapper: mapper,
@@ -55,8 +55,8 @@ func NewWaitTask(name string, ids object.ObjMetadataSet, cond Condition, timeout
5555
type WaitTask struct {
5656
// TaskName allows providing a name for the task.
5757
TaskName string
58-
// Ids is the full list of resources that we are waiting for.
59-
Ids object.ObjMetadataSet //nolint:revive
58+
// IDs is the full list of resources that we are waiting for.
59+
IDs object.ObjMetadataSet
6060
// Condition defines the status we want all resources to reach
6161
Condition Condition
6262
// Timeout defines how long we are willing to wait for the condition
@@ -85,14 +85,14 @@ func (w *WaitTask) Action() event.ResourceAction {
8585
}
8686

8787
func (w *WaitTask) Identifiers() object.ObjMetadataSet {
88-
return w.Ids
88+
return w.IDs
8989
}
9090

9191
// Start kicks off the task. For the wait task, this just means
9292
// setting up the timeout timer.
9393
func (w *WaitTask) Start(taskContext *TaskContext) {
9494
klog.V(2).Infof("wait task starting (name: %q, objects: %d)",
95-
w.Name(), len(w.Ids))
95+
w.Name(), len(w.IDs))
9696

9797
// TODO: inherit context from task runner, passed through the TaskContext
9898
ctx := context.Background()
@@ -149,10 +149,10 @@ func (w *WaitTask) startInner(taskContext *TaskContext) {
149149
w.mu.Lock()
150150
defer w.mu.Unlock()
151151

152-
klog.V(3).Infof("wait task progress: %d/%d", 0, len(w.Ids))
152+
klog.V(3).Infof("wait task progress: %d/%d", 0, len(w.IDs))
153153

154154
pending := object.ObjMetadataSet{}
155-
for _, id := range w.Ids {
155+
for _, id := range w.IDs {
156156
switch {
157157
case w.skipped(taskContext, id):
158158
err := taskContext.InventoryManager().SetSkippedReconcile(id)
@@ -183,7 +183,7 @@ func (w *WaitTask) startInner(taskContext *TaskContext) {
183183
}
184184
w.pending = pending
185185

186-
klog.V(3).Infof("wait task progress: %d/%d", len(w.Ids)-len(w.pending), len(w.Ids))
186+
klog.V(3).Infof("wait task progress: %d/%d", len(w.IDs)-len(w.pending), len(w.IDs))
187187

188188
if len(pending) == 0 {
189189
// all reconciled - clear pending and exit
@@ -351,7 +351,7 @@ func (w *WaitTask) StatusUpdate(taskContext *TaskContext, id object.ObjMetadata)
351351
w.sendEvent(taskContext, id, event.ReconcileFailed)
352352
// default - still pending
353353
}
354-
case !w.Ids.Contains(id):
354+
case !w.IDs.Contains(id):
355355
// not in wait group - ignore
356356
return
357357
case w.skipped(taskContext, id):
@@ -398,7 +398,7 @@ func (w *WaitTask) StatusUpdate(taskContext *TaskContext, id object.ObjMetadata)
398398
// else - still reconciled
399399
}
400400

401-
klog.V(3).Infof("wait task progress: %d/%d", len(w.Ids)-len(w.pending), len(w.Ids))
401+
klog.V(3).Infof("wait task progress: %d/%d", len(w.IDs)-len(w.pending), len(w.IDs))
402402

403403
// If we no longer have any pending resources, the WaitTask
404404
// can be completed.
@@ -415,7 +415,7 @@ func (w *WaitTask) StatusUpdate(taskContext *TaskContext, id object.ObjMetadata)
415415
// Resetting the mapper requires all CRDs to be queried again.
416416
func (w *WaitTask) updateRESTMapper(taskContext *TaskContext) {
417417
foundCRD := false
418-
for _, id := range w.Ids {
418+
for _, id := range w.IDs {
419419
if id.GroupKind == crdGK && !w.skipped(taskContext, id) {
420420
foundCRD = true
421421
break

pkg/object/validation/collector.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import (
1414
// extracting the IDs of the invalid objects.
1515
type Collector struct {
1616
Errors []error
17-
InvalidIds object.ObjMetadataSet //nolint:revive
17+
InvalidIDs object.ObjMetadataSet
1818
}
1919

2020
// Collect unwraps MultiErrors, adds them to Errors, extracts invalid object
21-
// IDs from validation.Error, and adds them to InvalidIds.
21+
// IDs from validation.Error, and adds them to InvalidIDs.
2222
func (c *Collector) Collect(err error) {
2323
errs := multierror.Unwrap(err)
24-
c.InvalidIds = c.InvalidIds.Union(extractInvalidIDs(errs))
24+
c.InvalidIDs = c.InvalidIDs.Union(extractInvalidIDs(errs))
2525
c.Errors = append(c.Errors, errs...)
2626
}
2727

@@ -31,21 +31,21 @@ func (c *Collector) ToError() error {
3131
}
3232

3333
// FilterInvalidObjects returns a set of objects that does not contain any
34-
// invalid objects, based on the collected InvalidIds.
34+
// invalid objects, based on the collected InvalidIDs.
3535
func (c *Collector) FilterInvalidObjects(objs object.UnstructuredSet) object.UnstructuredSet {
3636
var diff object.UnstructuredSet
3737
for _, obj := range objs {
38-
if !c.InvalidIds.Contains(object.UnstructuredToObjMetadata(obj)) {
38+
if !c.InvalidIDs.Contains(object.UnstructuredToObjMetadata(obj)) {
3939
diff = append(diff, obj)
4040
}
4141
}
4242
return diff
4343
}
4444

4545
// FilterInvalidIds returns a set of object ID that does not contain any
46-
// invalid IDs, based on the collected InvalidIds.
46+
// invalid IDs, based on the collected InvalidIDs.
4747
func (c *Collector) FilterInvalidIds(ids object.ObjMetadataSet) object.ObjMetadataSet { //nolint:revive
48-
return ids.Diff(c.InvalidIds)
48+
return ids.Diff(c.InvalidIDs)
4949
}
5050

5151
// extractInvalidIDs extracts invalid object IDs from a list of possible

0 commit comments

Comments
 (0)