build: fix file handle leak in GitHub release tool
This is a small patch to remove a defer statement found in a for loop. It instead closes the file after it is done copying the bytes from the tar file reader.
This commit is contained in:
parent
d4b2709fb0
commit
4f7f5404ce
1 changed files with 3 additions and 6 deletions
|
@ -374,16 +374,13 @@ func untar(srcFile, fileName, extractDir string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Couldn't open output file: %v", err)
|
log.Fatalf("Couldn't open output file: %v", err)
|
||||||
}
|
}
|
||||||
defer func() {
|
|
||||||
err := out.Close()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Couldn't close output: %v", err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
n, err := io.Copy(out, tarReader)
|
n, err := io.Copy(out, tarReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Couldn't write output file: %v", err)
|
log.Fatalf("Couldn't write output file: %v", err)
|
||||||
}
|
}
|
||||||
|
if err = out.Close(); err != nil {
|
||||||
|
log.Fatalf("Couldn't close output: %v", err)
|
||||||
|
}
|
||||||
log.Printf("Wrote %s (%d bytes) as %q", fileName, n, outPath)
|
log.Printf("Wrote %s (%d bytes) as %q", fileName, n, outPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue