diff --git a/pkg/apply/applier.go b/pkg/apply/applier.go index 057946e9..75b30b6a 100644 --- a/pkg/apply/applier.go +++ b/pkg/apply/applier.go @@ -311,7 +311,7 @@ func handleError(eventChannel chan event.Event, err error) { // for the passed non cluster-scoped localObjs, plus the namespace // of the passed inventory object. This is used to skip deleting // namespaces which have currently applied objects in them. -func localNamespaces(localInv inventory.Info, localObjs []object.ObjMetadata) sets.String { +func localNamespaces(localInv inventory.Info, localObjs []object.ObjMetadata) sets.String { // nolint:staticcheck namespaces := sets.NewString() for _, obj := range localObjs { if obj.Namespace != "" { diff --git a/pkg/apply/filter/current-uids-filter.go b/pkg/apply/filter/current-uids-filter.go index 88330c7b..8a6edba8 100644 --- a/pkg/apply/filter/current-uids-filter.go +++ b/pkg/apply/filter/current-uids-filter.go @@ -15,7 +15,7 @@ import ( // if an object should not be pruned (deleted) because it has recently // been applied. type CurrentUIDFilter struct { - CurrentUIDs sets.String + CurrentUIDs sets.String // nolint:staticcheck } // Name returns a filter identifier for logging. diff --git a/pkg/apply/filter/current-uids-filter_test.go b/pkg/apply/filter/current-uids-filter_test.go index e42238fd..b7f4393e 100644 --- a/pkg/apply/filter/current-uids-filter_test.go +++ b/pkg/apply/filter/current-uids-filter_test.go @@ -13,7 +13,7 @@ import ( func TestCurrentUIDFilter(t *testing.T) { tests := map[string]struct { - filterUIDs sets.String + filterUIDs sets.String // nolint:staticcheck objUID string expectedError error }{ diff --git a/pkg/apply/filter/local-namespaces-filter.go b/pkg/apply/filter/local-namespaces-filter.go index 2c9aecf4..1f9d7075 100644 --- a/pkg/apply/filter/local-namespaces-filter.go +++ b/pkg/apply/filter/local-namespaces-filter.go @@ -20,7 +20,7 @@ var ( // that are currently in use. Used to ensure we do not delete // namespaces with currently applied objects in them. type LocalNamespacesFilter struct { - LocalNamespaces sets.String + LocalNamespaces sets.String // nolint:staticcheck } // Name returns a filter identifier for logging. diff --git a/pkg/apply/filter/local-namespaces-filter_test.go b/pkg/apply/filter/local-namespaces-filter_test.go index 9bcae3c1..3221b90b 100644 --- a/pkg/apply/filter/local-namespaces-filter_test.go +++ b/pkg/apply/filter/local-namespaces-filter_test.go @@ -23,7 +23,7 @@ var testNamespace = &unstructured.Unstructured{ func TestLocalNamespacesFilter(t *testing.T) { tests := map[string]struct { - localNamespaces sets.String + localNamespaces sets.String // nolint:staticcheck namespace string expectedError error }{ diff --git a/pkg/inventory/manager.go b/pkg/inventory/manager.go index 6083b4fd..e9f18563 100644 --- a/pkg/inventory/manager.go +++ b/pkg/inventory/manager.go @@ -117,7 +117,7 @@ func (tc *Manager) AppliedResourceUID(id object.ObjMetadata) (types.UID, bool) { // AppliedResourceUIDs returns a set with the UIDs of all the // successfully applied resources. -func (tc *Manager) AppliedResourceUIDs() sets.String { +func (tc *Manager) AppliedResourceUIDs() sets.String { // nolint:staticcheck uids := sets.NewString() for _, objStatus := range tc.inventory.Status.Objects { if objStatus.Strategy == actuation.ActuationStrategyApply && diff --git a/pkg/kstatus/watcher/object_status_reporter.go b/pkg/kstatus/watcher/object_status_reporter.go index cd2741ad..e77f8282 100644 --- a/pkg/kstatus/watcher/object_status_reporter.go +++ b/pkg/kstatus/watcher/object_status_reporter.go @@ -350,7 +350,11 @@ func (w *ObjectStatusReporter) startInformerNow( return fmt.Errorf("failed to set error handler on new informer for %v: %v", mapping.Resource, err) } - informer.AddEventHandler(w.eventHandler(ctx, eventCh)) + _, err = informer.AddEventHandler(w.eventHandler(ctx, eventCh)) + if err != nil { + // Should never happen. + return fmt.Errorf("failed add event handler on new informer for %v: %v", mapping.Resource, err) + } // Start the informer in the background. // Informer will be stopped when the context is cancelled.