refactor: fix defer and handle error
This commit is contained in:
parent
7dce352366
commit
3b93f893fd
@ -111,14 +111,15 @@ var appCpCommand = &cli.Command{
|
||||
}
|
||||
} else {
|
||||
content, _, err := cl.CopyFromContainer(ctx, container.ID, srcPath)
|
||||
defer content.Close()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
fromTarOpts := &archive.TarOptions{NoOverwriteDirNonDir: true, Compression: archive.Gzip}
|
||||
archive.Untar(content, dstPath, fromTarOpts)
|
||||
defer content.Close()
|
||||
if err := archive.Untar(content, dstPath, fromTarOpts); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user