From 53474d15f39233d117f4afcdff7da9c38922b8bd Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Wed, 6 Nov 2024 16:31:57 +0000 Subject: [PATCH] Append errgroup errors to Run return error Signed-off-by: Richard Wall --- pkg/agent/run.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/agent/run.go b/pkg/agent/run.go index 5d3ad52d..fc66da68 100644 --- a/pkg/agent/run.go +++ b/pkg/agent/run.go @@ -50,7 +50,7 @@ var Flags AgentCmdFlags const schemaVersion string = "v2.0.0" // Run starts the agent process -func Run(cmd *cobra.Command, args []string) error { +func Run(cmd *cobra.Command, args []string) (returnErr error) { logs.Log.Printf("Preflight agent version: %s (%s)", version.PreflightVersion, version.Commit) ctx, cancel := context.WithCancel( klog.NewContext( @@ -85,8 +85,8 @@ func Run(cmd *cobra.Command, args []string) error { defer func() { cancel() if groupErr := group.Wait(); groupErr != nil { - err = multierror.Append( - err, + returnErr = multierror.Append( + returnErr, fmt.Errorf("failed to wait for controller-runtime component to stop: %v", groupErr), ) }