Skip to content

Commit 4eed344

Browse files
ignore the error value of sftpConn.Close
Signed-off-by: HassanAlsamahi <[email protected]>
1 parent c57dbc0 commit 4eed344

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmd/incus/file.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -340,22 +340,23 @@ func (c *cmdFileDelete) Run(cmd *cobra.Command, args []string) error {
340340
return fmt.Errorf(i18n.G("Invalid path %s"), resource.name)
341341
}
342342

343-
sftpconn, err := resource.server.GetInstanceFileSFTP(pathSpec[0])
343+
sftpConn, err := resource.server.GetInstanceFileSFTP(pathSpec[0])
344344
if err != nil {
345345
return err
346346
}
347-
defer sftpconn.Close()
347+
348+
defer func() { _ = sftpConn.Close() }()
348349

349350
if c.flagForce {
350-
err = sftpconn.RemoveAll(pathSpec[1])
351+
err = sftpConn.RemoveAll(pathSpec[1])
351352
if err != nil {
352353
return err
353354
}
354355

355356
return nil
356357
}
357358

358-
err = sftpconn.Remove(pathSpec[1])
359+
err = sftpConn.Remove(pathSpec[1])
359360
if err != nil {
360361
return err
361362
}

0 commit comments

Comments
 (0)