Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Harisabdullah committed Aug 7, 2023
1 parent e357a68 commit b96512a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ipinfo/cmd_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ func cmdDownload() error {

url := fmt.Sprintf("%s%s.%s?token=%s", dbDownloadURL, dbName, format, token)
err := downloadDb(url, fileName, format, fZip)
if err != nil {
return err
}

// fetch checksums from API and check if they match.
checksumUrl := fmt.Sprintf("%s%s.%s/checksums?token=%s", dbDownloadURL, dbName, format, token)
Expand All @@ -165,10 +168,6 @@ func cmdDownload() error {
return errors.New("checksums do not match. File might be corrupted")
}

if err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -288,8 +287,8 @@ func fetchChecksums(url string) (*ChecksumResponse, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()

defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
Expand Down

0 comments on commit b96512a

Please sign in to comment.