Fix: Implement golangci-lint suggestions

This commit is contained in:
Mauro Regli
2023-09-13 11:44:58 +02:00
committed by Mauro
parent f4a152ab22
commit ae61706a34
27 changed files with 51 additions and 62 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ func NewDownloader(downLimit int64, maxTries int, progress aptly.Progress) aptly
return downloader
}
func (downloader *downloaderImpl) checkRedirect(req *http.Request, via []*http.Request) error {
func (downloader *downloaderImpl) checkRedirect(req *http.Request, _ []*http.Request) error {
if downloader.progress != nil {
downloader.progress.Printf("Following redirect to %s...\n", req.URL)
}
+2 -2
View File
@@ -61,7 +61,7 @@ func (f *FakeDownloader) Empty() bool {
}
// GetLength returns content length of given url
func (f *FakeDownloader) GetLength(ctx context.Context, url string) (int64, error) {
func (f *FakeDownloader) GetLength(_ context.Context, url string) (int64, error) {
expectation, err := f.getExpectedRequest(url)
if err != nil {
return -1, err
@@ -89,7 +89,7 @@ func (f *FakeDownloader) getExpectedRequest(url string) (*expectedRequest, error
}
// DownloadWithChecksum performs fake download by matching against first expectation in the queue or any expectation, with cheksum verification
func (f *FakeDownloader) DownloadWithChecksum(ctx context.Context, url string, filename string, expected *utils.ChecksumInfo, ignoreMismatch bool) error {
func (f *FakeDownloader) DownloadWithChecksum(_ context.Context, url string, filename string, expected *utils.ChecksumInfo, ignoreMismatch bool) error {
expectation, err := f.getExpectedRequest(url)
if err != nil {
return err
+2 -2
View File
@@ -114,7 +114,7 @@ func (d *GrabDownloader) maybeSetupChecksum(req *grab.Request, expected *utils.C
return nil
}
func (d *GrabDownloader) download(ctx context.Context, url string, destination string, expected *utils.ChecksumInfo, ignoreMismatch bool) error {
func (d *GrabDownloader) download(_ context.Context, url string, destination string, expected *utils.ChecksumInfo, ignoreMismatch bool) error {
// TODO clean up dest dir on permanent failure
d.log("Download %s -> %s\n", url, destination)
@@ -155,7 +155,7 @@ func (d *GrabDownloader) GetProgress() aptly.Progress {
return d.progress
}
func (d *GrabDownloader) GetLength(ctx context.Context, url string) (int64, error) {
func (d *GrabDownloader) GetLength(_ context.Context, url string) (int64, error) {
resp, err := http.Head(url)
if err != nil {
return -1, err