DarthSim 2 лет назад
Родитель
Сommit
e719c9d39b
5 измененных файлов с 11 добавлено и 12 удалено
  1. 2 2
      etag/etag_test.go
  2. 2 2
      healthcheck.go
  3. 2 2
      imagedata/download.go
  4. 1 2
      imagemeta/heif.go
  5. 4 4
      processing_handler_test.go

+ 2 - 2
etag/etag_test.go

@@ -1,7 +1,7 @@
 package etag
 
 import (
-	"io/ioutil"
+	"io"
 	"os"
 	"strings"
 	"testing"
@@ -36,7 +36,7 @@ type EtagTestSuite struct {
 }
 
 func (s *EtagTestSuite) SetupSuite() {
-	logrus.SetOutput(ioutil.Discard)
+	logrus.SetOutput(io.Discard)
 }
 
 func (s *EtagTestSuite) TeardownSuite() {

+ 2 - 2
healthcheck.go

@@ -3,7 +3,7 @@ package main
 import (
 	"context"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net"
 	"net/http"
 	"os"
@@ -36,7 +36,7 @@ func healthcheck() int {
 	}
 	defer res.Body.Close()
 
-	msg, _ := ioutil.ReadAll(res.Body)
+	msg, _ := io.ReadAll(res.Body)
 	fmt.Fprintln(os.Stderr, string(msg))
 
 	if res.StatusCode != 200 {

+ 2 - 2
imagedata/download.go

@@ -4,7 +4,7 @@ import (
 	"compress/gzip"
 	"crypto/tls"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/http/cookiejar"
 	"time"
@@ -190,7 +190,7 @@ func requestImage(imageURL string, header http.Header, jar *cookiejar.Jar) (*htt
 	}
 
 	if res.StatusCode != 200 {
-		body, _ := ioutil.ReadAll(res.Body)
+		body, _ := io.ReadAll(res.Body)
 		res.Body.Close()
 
 		status := 404

+ 1 - 2
imagemeta/heif.go

@@ -6,7 +6,6 @@ import (
 	"errors"
 	"fmt"
 	"io"
-	"io/ioutil"
 
 	"github.com/imgproxy/imgproxy/v3/imagetype"
 )
@@ -55,7 +54,7 @@ func heifDiscardN(r io.Reader, n int64) error {
 		return err
 	}
 
-	_, err := io.CopyN(ioutil.Discard, r, n)
+	_, err := io.CopyN(io.Discard, r, n)
 	return err
 }
 

+ 4 - 4
processing_handler_test.go

@@ -3,7 +3,7 @@ package main
 import (
 	"bytes"
 	"fmt"
-	"io/ioutil"
+	"io"
 	"net/http"
 	"net/http/httptest"
 	"os"
@@ -44,7 +44,7 @@ func (s *ProcessingHandlerTestSuite) SetupSuite() {
 	err = initialize()
 	require.Nil(s.T(), err)
 
-	logrus.SetOutput(ioutil.Discard)
+	logrus.SetOutput(io.Discard)
 
 	s.router = buildRouter()
 }
@@ -77,14 +77,14 @@ func (s *ProcessingHandlerTestSuite) readTestFile(name string) []byte {
 	wd, err := os.Getwd()
 	require.Nil(s.T(), err)
 
-	data, err := ioutil.ReadFile(filepath.Join(wd, "testdata", name))
+	data, err := os.ReadFile(filepath.Join(wd, "testdata", name))
 	require.Nil(s.T(), err)
 
 	return data
 }
 
 func (s *ProcessingHandlerTestSuite) readBody(res *http.Response) []byte {
-	data, err := ioutil.ReadAll(res.Body)
+	data, err := io.ReadAll(res.Body)
 	require.Nil(s.T(), err)
 	return data
 }