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