Skip to content

Commit

Permalink
Append errgroup errors to Run return error
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Wall <[email protected]>
  • Loading branch information
wallrj committed Nov 6, 2024
1 parent fc1b8a0 commit 53474d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/agent/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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),
)
}
Expand Down

0 comments on commit 53474d1

Please sign in to comment.