build: simplify Close logic in WriteTempDockerfile

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2018-06-09 01:16:51 +00:00
parent ed75f6202b
commit 15674d9ee9
1 changed files with 2 additions and 6 deletions

View File

@ -111,12 +111,8 @@ func WriteTempDockerfile(rc io.ReadCloser) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
_, err = io.Copy(f, rc) defer f.Close()
if err != nil { if _, err := io.Copy(f, rc); err != nil {
f.Close()
return "", err
}
if err := f.Close(); err != nil {
return "", err return "", err
} }
return dockerfileDir, rc.Close() return dockerfileDir, rc.Close()