Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 4d798bd

Browse files
committed
chore: enable typeDefFirst rule from go-critic
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent bd0dc62 commit 4d798bd

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ linters:
2626
- importShadow
2727
- paramTypeCombine
2828
- rangeValCopy
29-
- typeDefFirst
3029
- unnamedResult
3130
- whyNoLint
3231
enable-all: true

pkg/sync/sync_context.go

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,57 @@ type SyncContext interface {
5757
GetState() (common.OperationPhase, string, []common.ResourceSyncResult)
5858
}
5959

60+
type syncContext struct {
61+
healthOverride health.HealthOverride
62+
permissionValidator common.PermissionValidator
63+
resources map[kubeutil.ResourceKey]reconciledResource
64+
hooks []*unstructured.Unstructured
65+
config *rest.Config
66+
rawConfig *rest.Config
67+
dynamicIf dynamic.Interface
68+
disco discovery.DiscoveryInterface
69+
extensionsclientset *clientset.Clientset
70+
kubectl kubeutil.Kubectl
71+
resourceOps kubeutil.ResourceOperations
72+
namespace string
73+
74+
dryRun bool
75+
skipDryRunOnMissingResource bool
76+
force bool
77+
validate bool
78+
skipHooks bool
79+
resourcesFilter func(key kubeutil.ResourceKey, target *unstructured.Unstructured, live *unstructured.Unstructured) bool
80+
prune bool
81+
replace bool
82+
serverSideApply bool
83+
serverSideApplyManager string
84+
pruneLast bool
85+
prunePropagationPolicy *metav1.DeletionPropagation
86+
pruneConfirmed bool
87+
clientSideApplyMigrationManager string
88+
enableClientSideApplyMigration bool
89+
90+
syncRes map[string]common.ResourceSyncResult
91+
startedAt time.Time
92+
revision string
93+
phase common.OperationPhase
94+
message string
95+
96+
log logr.Logger
97+
// lock to protect concurrent updates of the result list
98+
lock sync.Mutex
99+
100+
// syncNamespace is a function that will determine if the managed
101+
// namespace should be synced
102+
syncNamespace func(*unstructured.Unstructured, *unstructured.Unstructured) (bool, error)
103+
104+
syncWaveHook common.SyncWaveHook
105+
106+
applyOutOfSyncOnly bool
107+
// stores whether the resource is modified or not
108+
modificationResult map[kubeutil.ResourceKey]bool
109+
}
110+
60111
// SyncOpt is a callback that update sync operation settings
61112
type SyncOpt func(ctx *syncContext)
62113

@@ -340,57 +391,6 @@ func (sc *syncContext) getOperationPhase(obj *unstructured.Unstructured) (common
340391
return phase, message, nil
341392
}
342393

343-
type syncContext struct {
344-
healthOverride health.HealthOverride
345-
permissionValidator common.PermissionValidator
346-
resources map[kubeutil.ResourceKey]reconciledResource
347-
hooks []*unstructured.Unstructured
348-
config *rest.Config
349-
rawConfig *rest.Config
350-
dynamicIf dynamic.Interface
351-
disco discovery.DiscoveryInterface
352-
extensionsclientset *clientset.Clientset
353-
kubectl kubeutil.Kubectl
354-
resourceOps kubeutil.ResourceOperations
355-
namespace string
356-
357-
dryRun bool
358-
skipDryRunOnMissingResource bool
359-
force bool
360-
validate bool
361-
skipHooks bool
362-
resourcesFilter func(key kubeutil.ResourceKey, target *unstructured.Unstructured, live *unstructured.Unstructured) bool
363-
prune bool
364-
replace bool
365-
serverSideApply bool
366-
serverSideApplyManager string
367-
pruneLast bool
368-
prunePropagationPolicy *metav1.DeletionPropagation
369-
pruneConfirmed bool
370-
clientSideApplyMigrationManager string
371-
enableClientSideApplyMigration bool
372-
373-
syncRes map[string]common.ResourceSyncResult
374-
startedAt time.Time
375-
revision string
376-
phase common.OperationPhase
377-
message string
378-
379-
log logr.Logger
380-
// lock to protect concurrent updates of the result list
381-
lock sync.Mutex
382-
383-
// syncNamespace is a function that will determine if the managed
384-
// namespace should be synced
385-
syncNamespace func(*unstructured.Unstructured, *unstructured.Unstructured) (bool, error)
386-
387-
syncWaveHook common.SyncWaveHook
388-
389-
applyOutOfSyncOnly bool
390-
// stores whether the resource is modified or not
391-
modificationResult map[kubeutil.ResourceKey]bool
392-
}
393-
394394
func (sc *syncContext) setRunningPhase(tasks []*syncTask, isPendingDeletion bool) {
395395
if len(tasks) > 0 {
396396
firstTask := tasks[0]

0 commit comments

Comments
 (0)