update golangci-lint and replace deprecated calls to io/ioutil

This commit is contained in:
Markus Muellner
2022-09-22 17:18:14 +02:00
committed by Benj Fassbind
parent 71fd730598
commit 352f4e8772
23 changed files with 30 additions and 52 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
@@ -56,7 +55,7 @@ func NewDownloader(downLimit int64, maxTries int, progress aptly.Progress) aptly
progressWriter := io.Writer(progress)
if progress == nil {
progressWriter = ioutil.Discard
progressWriter = io.Discard
}
downloader.client.CheckRedirect = downloader.checkRedirect

View File

@@ -3,7 +3,6 @@ package http
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
@@ -27,7 +26,7 @@ type DownloaderSuiteBase struct {
}
func (s *DownloaderSuiteBase) SetUpTest(c *C) {
s.tempfile, _ = ioutil.TempFile(os.TempDir(), "aptly-test")
s.tempfile, _ = os.CreateTemp(os.TempDir(), "aptly-test")
s.l, _ = net.ListenTCP("tcp4", &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1)})
s.url = fmt.Sprintf("http://localhost:%d", s.l.Addr().(*net.TCPAddr).Port)

View File

@@ -3,7 +3,6 @@ package http
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
"os"
@@ -26,7 +25,7 @@ type GrabDownloaderSuiteBase struct {
}
func (s *GrabDownloaderSuiteBase) SetUpTest(c *C) {
s.tempfile, _ = ioutil.TempFile(os.TempDir(), "aptly-test")
s.tempfile, _ = os.CreateTemp(os.TempDir(), "aptly-test")
s.l, _ = net.ListenTCP("tcp4", &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1)})
s.url = fmt.Sprintf("http://localhost:%d", s.l.Addr().(*net.TCPAddr).Port)

View File

@@ -2,7 +2,6 @@ package http
import (
"context"
"io/ioutil"
"os"
"path/filepath"
@@ -21,7 +20,7 @@ func DownloadTemp(ctx context.Context, downloader aptly.Downloader, url string)
//
// Temporary file would be already removed, so no need to cleanup
func DownloadTempWithChecksum(ctx context.Context, downloader aptly.Downloader, url string, expected *utils.ChecksumInfo, ignoreMismatch bool) (*os.File, error) {
tempdir, err := ioutil.TempDir(os.TempDir(), "aptly")
tempdir, err := os.MkdirTemp(os.TempDir(), "aptly")
if err != nil {
return nil, err
}