Skip to content

Commit 3ee8954

Browse files
committed
Format code with go fmt
Apply formatting fixes from go fmt: - Fix indentation in test cases and error handling - Remove trailing whitespace - Standardize code formatting across files Signed-off-by: Ant Weiss <anton@otomato.io>
1 parent 52904de commit 3ee8954

File tree

5 files changed

+32
-33
lines changed

5 files changed

+32
-33
lines changed

internal/pipeline/integration_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -414,31 +414,31 @@ func TestPromptTemplateExpansion(t *testing.T) {
414414
event: interfaces.Event{
415415
Type: "pod-restart",
416416
},
417-
expected: "Known: pod-restart, Unknown: <no value>",
418-
},
419-
{
420-
name: "Template with metadata access",
421-
template: "Issue: {{.Metadata.issue}}, Project: {{.Metadata.project}}",
422-
event: interfaces.Event{
423-
Type: "resolve-issue",
424-
Metadata: map[string]interface{}{
425-
"issue": "ECS-11",
426-
"project": "KhookProject",
427-
},
417+
expected: "Known: pod-restart, Unknown: <no value>",
428418
},
429-
expected: "Issue: ECS-11, Project: KhookProject",
430-
},
431-
{
432-
name: "Template with nested metadata",
433-
template: "Order {{.Metadata.orderId}} total: ${{.Metadata.amount}}",
434-
event: interfaces.Event{
435-
Type: "order-placed",
436-
Metadata: map[string]interface{}{
437-
"orderId": "ORD-123",
438-
"amount": 99.99,
419+
{
420+
name: "Template with metadata access",
421+
template: "Issue: {{.Metadata.issue}}, Project: {{.Metadata.project}}",
422+
event: interfaces.Event{
423+
Type: "resolve-issue",
424+
Metadata: map[string]interface{}{
425+
"issue": "ECS-11",
426+
"project": "KhookProject",
427+
},
439428
},
429+
expected: "Issue: ECS-11, Project: KhookProject",
440430
},
441-
expected: "Order ORD-123 total: $99.99",
431+
{
432+
name: "Template with nested metadata",
433+
template: "Order {{.Metadata.orderId}} total: ${{.Metadata.amount}}",
434+
event: interfaces.Event{
435+
Type: "order-placed",
436+
Metadata: map[string]interface{}{
437+
"orderId": "ORD-123",
438+
"amount": 99.99,
439+
},
440+
},
441+
expected: "Order ORD-123 total: $99.99",
442442
},
443443
}
444444

internal/status/manager.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ func (m *Manager) UpdateHookStatus(ctx context.Context, hook *v1alpha2.Hook, act
8383
time.Sleep(time.Millisecond * 100 * time.Duration(attempt+1))
8484
continue
8585
}
86-
m.logger.Error(err, "Failed to update hook status",
87-
"hook", hook.Name,
86+
m.logger.Error(err, "Failed to update hook status",
87+
"hook", hook.Name,
8888
"namespace", hook.Namespace,
8989
"attempt", attempt+1)
9090
return fmt.Errorf("failed to update hook status after %d attempts: %w", attempt+1, err)
91-
}
91+
}
9292

9393
// Success
94-
m.logger.Info("Successfully updated hook status",
95-
"hook", hook.Name,
96-
"namespace", hook.Namespace,
94+
m.logger.Info("Successfully updated hook status",
95+
"hook", hook.Name,
96+
"namespace", hook.Namespace,
9797
"lastUpdated", latestHook.Status.LastUpdated.Time,
9898
"attempt", attempt+1)
99-
return nil
99+
return nil
100100
}
101101

102102
return fmt.Errorf("failed to update hook status after %d attempts", maxRetries)

internal/workflow/coordinator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ func (c *Coordinator) manageNamespaceWorkflow(
117117

118118
if state, exists := c.namespaceStates[namespace]; exists {
119119
if state.Signature == signature {
120-
c.logger.V(1).Info("No changes in hooks; keeping workflow running",
120+
c.logger.V(1).Info("No changes in hooks; keeping workflow running",
121121
"namespace", namespace,
122122
"currentSignature", signature,
123123
"previousSignature", state.Signature)
124124
return
125125
}
126126

127-
c.logger.Info("Restarting namespace workflow due to hook changes",
127+
c.logger.Info("Restarting namespace workflow due to hook changes",
128128
"namespace", namespace,
129129
"oldSignature", state.Signature,
130130
"newSignature", signature)

internal/workflow/workflow_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (wm *WorkflowManager) runNamespaceWorkflow(
123123
if err == context.Canceled {
124124
wm.logger.Info("Namespace workflow stopped (context canceled)", "namespace", namespace)
125125
} else {
126-
wm.logger.Error(err, "Namespace workflow exited with error", "namespace", namespace)
126+
wm.logger.Error(err, "Namespace workflow exited with error", "namespace", namespace)
127127
}
128128
} else {
129129
wm.logger.Info("Namespace workflow finished", "namespace", namespace)

internal/workflow/workflow_manager_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,3 @@ func TestCalculateSignatureChangesOnPromptUpdate(t *testing.T) {
185185
// Signatures should be different
186186
assert.NotEqual(t, sig1, sig2, "Signature should change when prompt is updated")
187187
}
188-

0 commit comments

Comments
 (0)