Skip to content

Commit b34781e

Browse files
fix(commands): fix error shadowing in direct patch path
Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent d82aa2a commit b34781e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎pkg/commands/apply.go‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func apply(args []string) error {
132132
TryModeTimeout: durationpb.New(applyCmdFlags.configTryTimeout),
133133
})
134134
if err != nil {
135-
return fmt.Errorf("error applying new configuration: %s", err)
135+
return fmt.Errorf("error applying new configuration: %w", err)
136136
}
137137

138138
helpers.PrintApplyResults(resp)
@@ -153,7 +153,7 @@ func apply(args []string) error {
153153
return fmt.Errorf("error serializing configuration: %w", err)
154154
}
155155

156-
err = withApplyClient(func(ctx context.Context, c *client.Client) error {
156+
if err := withApplyClient(func(ctx context.Context, c *client.Client) error {
157157
fmt.Printf("- talm: file=%s, nodes=%s, endpoints=%s\n", configFile, GlobalArgs.Nodes, GlobalArgs.Endpoints)
158158

159159
resp, err := c.ApplyConfiguration(ctx, &machineapi.ApplyConfigurationRequest{
@@ -163,13 +163,15 @@ func apply(args []string) error {
163163
TryModeTimeout: durationpb.New(applyCmdFlags.configTryTimeout),
164164
})
165165
if err != nil {
166-
return fmt.Errorf("error applying new configuration: %s", err)
166+
return fmt.Errorf("error applying new configuration: %w", err)
167167
}
168168

169169
helpers.PrintApplyResults(resp)
170170

171171
return nil
172-
})
172+
}); err != nil {
173+
return err
174+
}
173175
}
174176
if err != nil {
175177
return err

0 commit comments

Comments
 (0)