mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-27 21:44:26 -04:00
Gocritic changes
This commit is contained in:
parent
4bc0236cf8
commit
8f13b57ae8
7 changed files with 17 additions and 18 deletions
|
@ -28,9 +28,12 @@ type ProgressReporter interface {
|
|||
Cancelled() bool
|
||||
}
|
||||
|
||||
func downloadFile(progressReporter ProgressReporter, client *grab.Client, downloadURL string, dstPath string, doRetries bool) error {
|
||||
func downloadFile(progressReporter ProgressReporter, client *grab.Client, downloadURL, dstPath string, doRetries bool) error {
|
||||
filePath := filepath.Base(dstPath)
|
||||
|
||||
t := time.NewTicker(500 * time.Millisecond)
|
||||
defer t.Stop()
|
||||
|
||||
for attempt := 1; attempt <= maxRetries; attempt++ {
|
||||
req, err := grab.NewRequest(dstPath, downloadURL)
|
||||
if err != nil {
|
||||
|
@ -41,9 +44,6 @@ func downloadFile(progressReporter ProgressReporter, client *grab.Client, downlo
|
|||
resp := client.Do(req)
|
||||
progressReporter.UpdateDownloadProgress(resp, filePath)
|
||||
|
||||
t := time.NewTicker(500 * time.Millisecond)
|
||||
defer t.Stop()
|
||||
|
||||
Loop:
|
||||
for {
|
||||
select {
|
||||
|
@ -69,7 +69,7 @@ func downloadFile(progressReporter ProgressReporter, client *grab.Client, downlo
|
|||
return nil
|
||||
}
|
||||
|
||||
func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, progressReporter ProgressReporter, deleteEncryptedContents bool, logger *Logger) error {
|
||||
func DownloadTitle(titleID, outputDirectory string, doDecryption bool, progressReporter ProgressReporter, deleteEncryptedContents bool, logger *Logger) error {
|
||||
titleEntry := getTitleEntryFromTid(titleID)
|
||||
|
||||
progressReporter.SetGameTitle(titleEntry.Name)
|
||||
|
@ -179,7 +179,7 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
|
|||
if err := binary.Read(tmdDataReader, binary.BigEndian, &content.Size); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := checkContentHashes(outputDirectory, content, &cipherHashTree); err != nil {
|
||||
if err := checkContentHashes(outputDirectory, content, cipherHashTree); err != nil {
|
||||
if progressReporter.Cancelled() {
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue