Skip to content

Commit 53474d1

Browse files
committed
Append errgroup errors to Run return error
Signed-off-by: Richard Wall <[email protected]>
1 parent fc1b8a0 commit 53474d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/agent/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var Flags AgentCmdFlags
5050
const schemaVersion string = "v2.0.0"
5151

5252
// Run starts the agent process
53-
func Run(cmd *cobra.Command, args []string) error {
53+
func Run(cmd *cobra.Command, args []string) (returnErr error) {
5454
logs.Log.Printf("Preflight agent version: %s (%s)", version.PreflightVersion, version.Commit)
5555
ctx, cancel := context.WithCancel(
5656
klog.NewContext(
@@ -85,8 +85,8 @@ func Run(cmd *cobra.Command, args []string) error {
8585
defer func() {
8686
cancel()
8787
if groupErr := group.Wait(); groupErr != nil {
88-
err = multierror.Append(
89-
err,
88+
returnErr = multierror.Append(
89+
returnErr,
9090
fmt.Errorf("failed to wait for controller-runtime component to stop: %v", groupErr),
9191
)
9292
}

0 commit comments

Comments
 (0)