From 401c41160c753f11f8ebe7bea37c8ed7fd3d35dd Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Wed, 25 Jun 2025 19:52:54 +0300 Subject: [PATCH] chore: pass all options to download --- assets/coverage-badge.svg | 4 ++-- internal/translations/default.pot | 6 +++--- internal/translations/po/ru/default.po | 6 +++--- pkg/dl/dl.go | 26 ++++++++------------------ 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/assets/coverage-badge.svg b/assets/coverage-badge.svg index b7b7768..4257307 100644 --- a/assets/coverage-badge.svg +++ b/assets/coverage-badge.svg @@ -11,7 +11,7 @@ coverage coverage - 19.7% - 19.7% + 19.8% + 19.8% diff --git a/internal/translations/default.pot b/internal/translations/default.pot index 50b506e..c63ca19 100644 --- a/internal/translations/default.pot +++ b/internal/translations/default.pot @@ -445,15 +445,15 @@ msgstr "" msgid "Source can be updated, updating if required" msgstr "" -#: pkg/dl/dl.go:201 +#: pkg/dl/dl.go:196 msgid "Source found in cache and linked to destination" msgstr "" -#: pkg/dl/dl.go:208 +#: pkg/dl/dl.go:203 msgid "Source updated and linked to destination" msgstr "" -#: pkg/dl/dl.go:222 +#: pkg/dl/dl.go:217 msgid "Downloading source" msgstr "" diff --git a/internal/translations/po/ru/default.po b/internal/translations/po/ru/default.po index f5f847f..06aee9b 100644 --- a/internal/translations/po/ru/default.po +++ b/internal/translations/po/ru/default.po @@ -461,15 +461,15 @@ msgstr "Ошибка при запуске приложения" msgid "Source can be updated, updating if required" msgstr "Исходный код можно обновлять, обновляя при необходимости" -#: pkg/dl/dl.go:201 +#: pkg/dl/dl.go:196 msgid "Source found in cache and linked to destination" msgstr "Источник найден в кэше и связан с пунктом назначения" -#: pkg/dl/dl.go:208 +#: pkg/dl/dl.go:203 msgid "Source updated and linked to destination" msgstr "Источник обновлён и связан с пунктом назначения" -#: pkg/dl/dl.go:222 +#: pkg/dl/dl.go:217 msgid "Downloading source" msgstr "Скачивание источника" diff --git a/pkg/dl/dl.go b/pkg/dl/dl.go index 6c349c1..71ceade 100644 --- a/pkg/dl/dl.go +++ b/pkg/dl/dl.go @@ -172,15 +172,10 @@ func Download(ctx context.Context, opts Options) (err error) { "downloader", d.Name(), ) - updated, err = d.Update(Options{ - Hash: opts.Hash, - HashAlgorithm: opts.HashAlgorithm, - Name: opts.Name, - URL: opts.URL, - Destination: cacheDir, - Progress: opts.Progress, - LocalDir: opts.LocalDir, - }) + newOpts := opts + newOpts.Destination = cacheDir + + updated, err = d.Update(newOpts) if err != nil { return err } @@ -226,15 +221,10 @@ func Download(ctx context.Context, opts Options) (err error) { return err } - t, name, err := d.Download(ctx, Options{ - Hash: opts.Hash, - HashAlgorithm: opts.HashAlgorithm, - Name: opts.Name, - URL: opts.URL, - Destination: cacheDir, - Progress: opts.Progress, - LocalDir: opts.LocalDir, - }) + newOpts := opts + newOpts.Destination = cacheDir + + t, name, err := d.Download(ctx, newOpts) if err != nil { return err }