Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
zreigz committed Jul 17, 2024
1 parent c37c3e7 commit cba8c85
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/controller/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewDefaultScope[T client.Object](ctx context.Context, client client.Client,

helper, err := patch.NewHelper(object, client)
if err != nil {
return nil, fmt.Errorf("failed to create new helper, go error: %s", err)
return nil, fmt.Errorf("failed to create new helper, go error: %w", err)
}

return &DefaultScope[T]{
Expand Down
2 changes: 2 additions & 0 deletions internal/kstatus/watcher/object_status_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (in *ObjectStatusReporter) Start(ctx context.Context) <-chan event.Event {
}
}()

//nolint
go wait.PollUntilContextCancel(ctx, 5*time.Second, false, func(_ context.Context) (done bool, err error) {
stopped := true
for _, ref := range in.watcherRefs {
Expand Down Expand Up @@ -334,6 +335,7 @@ func (in *ObjectStatusReporter) startInformerWithRetry(ctx context.Context, gkn
// CRD (or api extension) not installed, retry
klog.V(3).Infof("Watch start error (blocking until CRD is added): %v: %v", gkn, err)
in.restartInformer(gkn)
retryCount++
return
}

Expand Down
1 change: 0 additions & 1 deletion internal/kstatus/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type DynamicStatusWatcher struct {

// informerRefs tracks which informers have been started and stopped by the ObjectStatusReporter
informerRefs map[GroupKindNamespace]*watcherReference
name string
}

func (in *DynamicStatusWatcher) Watch(ctx context.Context, ids object.ObjMetadataSet, opts kwatcher.Options) <-chan event.Event {
Expand Down
2 changes: 1 addition & 1 deletion internal/kubernetes/watcher/retry_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
return false, 0
}

if apierrors.IsNotFound(err) || errors.Is(err, context.Canceled){
if apierrors.IsNotFound(err) || errors.Is(err, context.Canceled) {
klog.V(5).InfoS(msg, "err", err)
// Stop
return true, 0
Expand Down
4 changes: 2 additions & 2 deletions pkg/cache/resource_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func Init(ctx context.Context, config *rest.Config, ttl time.Duration) {
UseCustomObjectFilter: true,
ObjectFilter: nil,
//UseInformerRefCache: true,
RESTScopeStrategy: lo.ToPtr(kwatcher.RESTScopeRoot),
RESTScopeStrategy: lo.ToPtr(kwatcher.RESTScopeRoot),
Filters: &kwatcher.Filters{
Labels: common.ManagedByAgentLabelSelector(),
Fields: nil,
Expand Down Expand Up @@ -177,7 +177,7 @@ func (in *ResourceCache) Unregister(inventoryResourceKeys containers.Set[Resourc

toRemove := in.resourceKeySet.Difference(inventoryResourceKeys)

for key, _ := range toRemove {
for key := range toRemove {
in.resourceKeySet.Remove(key)
// TODO: we should trigger a watch stop too
}
Expand Down

0 comments on commit cba8c85

Please sign in to comment.