Skip to content

Commit ffe4de5

Browse files
committed
chore: golangci-lint
Signed-off-by: Alex Jun <lushcluejug@gmail.com>
1 parent dd8832f commit ffe4de5

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

fault-remediation/pkg/config/config.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ type TomlConfig struct {
8585
// Common configuration
8686
UpdateRetry UpdateRetry `toml:"updateRetry"`
8787

88-
// RemediationActions and ComponentRemediationActions define a static mapping from healthEvent attributes to MaintenanceResource
88+
// RemediationActions and ComponentRemediationActions define a static mapping
89+
// from healthEvent attributes to MaintenanceResource
8990

9091
// ComponentClass, RecommendedAction -> MaintenanceResource
9192
ComponentRemediationActions ComponentRemediationActions `toml:"componentRemediationActions"`
@@ -145,7 +146,10 @@ func (c *TomlConfig) validateRemediationAction(actionName string, resource Maint
145146
return nil
146147
}
147148

148-
func (c *TomlConfig) validateComponentRemediationAction(componentClass, actionName string, resource MaintenanceResource) error {
149+
func (c *TomlConfig) validateComponentRemediationAction(
150+
componentClass, actionName string,
151+
resource MaintenanceResource,
152+
) error {
149153
if componentClass == "" {
150154
return fmt.Errorf("componentRemediationActions must have a non-empty componentClass")
151155
}
@@ -306,8 +310,8 @@ func (c *TomlConfig) ComponentActionNames(componentClass string) []string {
306310
// ResolveStoredMaintenanceResource resolves the maintenance resource for a
307311
// remediation entry previously stored in the node annotation.
308312
//
309-
// Older remediation annotations may not have ComponentClass populated.
310-
// When componentClass is unpopulated, we will resolve the action when it is still unambiguous in the current config.
313+
// Older remediation annotations may not have ComponentClass populated.
314+
// When componentClass is unpopulated, we will resolve the action when it is still unambiguous in the current config.
311315
// If ambiguous, it will be treated as stale.
312316
func (c *TomlConfig) ResolveStoredMaintenanceResource(componentClass, actionName string) (MaintenanceResource, bool) {
313317
if componentClass != "" {

fault-remediation/pkg/crstatus/checker.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func (c *CRStatusChecker) ShouldSkipCRCreation(ctx context.Context, componentCla
5656
slog.Error("No remediation configuration found for action",
5757
"action", actionName,
5858
"componentClass", componentClass)
59+
5960
return false
6061
}
6162

@@ -80,6 +81,7 @@ func (c *CRStatusChecker) ShouldSkipCRCreation(ctx context.Context, componentCla
8081
"componentClass", componentClass,
8182
"gvk", gvk.String(),
8283
"error", err)
84+
8385
return false
8486
}
8587

fault-remediation/pkg/remediation/remediation.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type FaultRemediationClient struct {
7070
statusChecker *crstatus.CRStatusChecker
7171
}
7272

73+
// nolint:cyclop
7374
func NewRemediationClient(
7475
client client.Client,
7576
dryRun bool,
@@ -110,8 +111,9 @@ func NewRemediationClient(
110111
for componentClass, actions := range remediationConfig.ComponentRemediationActions {
111112
for actionName, maintenanceResource := range actions {
112113
if maintenanceResource.Scope == "Namespaced" && maintenanceResource.Namespace == "" {
113-
return nil, fmt.Errorf("remediation action %s for componentClass %s is namespaced but missing namespace configuration",
114-
actionName, componentClass)
114+
return nil,
115+
fmt.Errorf("remediation action %s for componentClass %s is namespaced but missing namespace configuration",
116+
actionName, componentClass)
115117
}
116118
}
117119
}

0 commit comments

Comments
 (0)