From 8125e1afb79c5ea226f3bb8def2c5c1f5d2605c4 Mon Sep 17 00:00:00 2001 From: Ugurcan Emre Atas Date: Fri, 27 Sep 2024 19:48:57 +0200 Subject: [PATCH] rename variable --- mkbsd.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkbsd.go b/mkbsd.go index e1e55d4..2e36713 100644 --- a/mkbsd.go +++ b/mkbsd.go @@ -22,7 +22,7 @@ type Response struct { const DATA_URL = "https://storage.googleapis.com/panels-api/data/20240916/media-1a-i-p~s" -func downloadImages(x string, rawURL string, downloadsPath string, wg *sync.WaitGroup, channel chan<- string) { +func downloadImages(key string, rawURL string, downloadsPath string, wg *sync.WaitGroup, channel chan<- string) { defer wg.Done() resp, err := http.Get(rawURL) @@ -35,7 +35,7 @@ func downloadImages(x string, rawURL string, downloadsPath string, wg *sync.Wait defer resp.Body.Close() - imageFileName := filepath.Join(downloadsPath, x+".jpg") + imageFileName := filepath.Join(downloadsPath, key+".jpg") outFile, err := os.Create(imageFileName) if err != nil { res := fmt.Sprintf("failed to create file: %v", err) @@ -101,10 +101,10 @@ func main() { var wg sync.WaitGroup - for x, v := range response.Data { + for key, v := range response.Data { if v.Dhd != "" { wg.Add(1) - go downloadImages(x, v.Dhd, downloadsPath, &wg, channel) + go downloadImages(key, v.Dhd, downloadsPath, &wg, channel) } }