mirror of https://github.com/databricks/cli.git
add close statements
This commit is contained in:
parent
8e92131a46
commit
33be6b9cf2
|
@ -33,6 +33,7 @@ func download(url string, dest string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, err = io.Copy(f, resp.Body)
|
||||
return err
|
||||
|
|
|
@ -13,6 +13,7 @@ func Extract(src string, dst string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer zipReader.Close()
|
||||
|
||||
return fs.WalkDir(zipReader, ".", func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
|
@ -28,11 +29,13 @@ func Extract(src string, dst string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer targetFile.Close()
|
||||
|
||||
sourceFile, err := zipReader.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer sourceFile.Close()
|
||||
|
||||
_, err = io.Copy(targetFile, sourceFile)
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue