From 3752ebc8d6b05343a195a826e150129edbeb3ce4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 06:24:20 +0000 Subject: [PATCH] Apply Enabled() guards consistently to all logger calls in workflow_errors.go PR #27990 fixed the missing Enabled() guard on errorHelpersLog calls. Apply the same pattern consistently to errorAggregationLog and sharedWorkflowLog calls in the same file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/workflow/workflow_errors.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkg/workflow/workflow_errors.go b/pkg/workflow/workflow_errors.go index c7eb5913677..961f5115cd7 100644 --- a/pkg/workflow/workflow_errors.go +++ b/pkg/workflow/workflow_errors.go @@ -193,7 +193,9 @@ type ErrorCollector struct { // NewErrorCollector creates a new error collector // If failFast is true, the collector will stop at the first error func NewErrorCollector(failFast bool) *ErrorCollector { - errorAggregationLog.Printf("Creating error collector: fail_fast=%v", failFast) + if errorAggregationLog.Enabled() { + errorAggregationLog.Printf("Creating error collector: fail_fast=%v", failFast) + } return &ErrorCollector{ errors: make([]error, 0), failFast: failFast, @@ -208,10 +210,14 @@ func (c *ErrorCollector) Add(err error) error { return nil } - errorAggregationLog.Printf("Adding error to collector: %v", err) + if errorAggregationLog.Enabled() { + errorAggregationLog.Printf("Adding error to collector: %v", err) + } if c.failFast { - errorAggregationLog.Print("Fail-fast enabled, returning error immediately") + if errorAggregationLog.Enabled() { + errorAggregationLog.Print("Fail-fast enabled, returning error immediately") + } return err } @@ -231,7 +237,9 @@ func (c *ErrorCollector) Error() error { return nil } - errorAggregationLog.Printf("Aggregating %d errors", len(c.errors)) + if errorAggregationLog.Enabled() { + errorAggregationLog.Printf("Aggregating %d errors", len(c.errors)) + } if len(c.errors) == 1 { return c.errors[0] @@ -248,7 +256,9 @@ func (c *ErrorCollector) FormattedError(category string) error { return nil } - errorAggregationLog.Printf("Formatting %d errors for category: %s", len(c.errors), category) + if errorAggregationLog.Enabled() { + errorAggregationLog.Printf("Formatting %d errors for category: %s", len(c.errors), category) + } if len(c.errors) == 1 { return c.errors[0] @@ -271,7 +281,9 @@ type SharedWorkflowError struct { // Error implements the error interface // Returns a formatted info message explaining that this is a shared workflow func (e *SharedWorkflowError) Error() string { - sharedWorkflowLog.Printf("Formatting info message for shared workflow: %s", e.Path) + if sharedWorkflowLog.Enabled() { + sharedWorkflowLog.Printf("Formatting info message for shared workflow: %s", e.Path) + } filename := filepath.Base(e.Path)