mirror of
				https://github.com/imgproxy/imgproxy.git
				synced 2025-10-30 23:08:02 +02:00 
			
		
		
		
	Get rid of io/ioutil usage
This commit is contained in:
		| @@ -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() { | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user