Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check err before using file object #12

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/releaseapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,20 @@ func (c *Client) downloadBuild(build Build, checkSha256Sum string) (string, erro
log.Printf("dowloading release archive from %s", build.URL)

zipFile, zipLength, err := c.downloadReleaseArchive(build)
defer os.Remove(zipFile.Name())
defer zipFile.Close()

if err != nil {
return "", err
}

defer os.Remove(zipFile.Name())
defer zipFile.Close()

f, err := os.Open(zipFile.Name())

if err != nil {
return "", errors.Wrap(err, "could not open zip archive")
}

defer f.Close()

h := sha256.New()
Expand Down
Loading