Skip to content

Commit bcf0d0c

Browse files
committed
Remove deprecated io/ioutil usage
1 parent f3d2341 commit bcf0d0c

File tree

9 files changed

+14
-18
lines changed

9 files changed

+14
-18
lines changed

internal/klauspost_snappy/klauspost_snappy.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ package klauspost_snappy
3030

3131
import (
3232
"io"
33-
"io/ioutil"
3433
"sync"
3534

3635
snappylib "github.com/klauspost/compress/s2"
@@ -61,7 +60,7 @@ func PretendInit(clobbering bool) {
6160

6261
c := &compressor{}
6362
c.poolCompressor.New = func() interface{} {
64-
w := snappylib.NewWriter(ioutil.Discard, snappylib.WriterSnappyCompat())
63+
w := snappylib.NewWriter(io.Discard, snappylib.WriterSnappyCompat())
6564
return &writer{Writer: w, pool: &c.poolCompressor}
6665
}
6766
encoding.RegisterCompressor(c)

internal/klauspost_snappy/klauspost_snappy_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package klauspost_snappy
2121
import (
2222
"bytes"
2323
"context"
24-
"io/ioutil"
24+
"io"
2525
"net"
2626
"testing"
2727

@@ -58,7 +58,7 @@ func TestRegisteredCompression(t *testing.T) {
5858

5959
r, err := comp.Decompress(buf)
6060
require.NoError(t, err)
61-
expected, err := ioutil.ReadAll(r)
61+
expected, err := io.ReadAll(r)
6262
require.NoError(t, err)
6363

6464
assert.Equal(t, message, string(expected))

internal/lz4/lz4.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ package lz4
2424

2525
import (
2626
"io"
27-
"io/ioutil"
2827
"sync"
2928

3029
lz4lib "github.com/pierrec/lz4/v4"
@@ -55,7 +54,7 @@ func PretendInit(clobbering bool) {
5554

5655
c := &compressor{}
5756
c.poolCompressor.New = func() interface{} {
58-
w := lz4lib.NewWriter(ioutil.Discard)
57+
w := lz4lib.NewWriter(io.Discard)
5958
return &writer{Writer: w, pool: &c.poolCompressor}
6059
}
6160
encoding.RegisterCompressor(c)

internal/lz4/lz4_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package lz4
2121
import (
2222
"bytes"
2323
"context"
24-
"io/ioutil"
24+
"io"
2525
"net"
2626
"testing"
2727

@@ -58,7 +58,7 @@ func TestRegisteredCompression(t *testing.T) {
5858

5959
r, err := comp.Decompress(buf)
6060
require.NoError(t, err)
61-
expected, err := ioutil.ReadAll(r)
61+
expected, err := io.ReadAll(r)
6262
require.NoError(t, err)
6363

6464
assert.Equal(t, message, string(expected))

internal/s2/s2.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package s2
1818

1919
import (
2020
"io"
21-
"io/ioutil"
2221
"sync"
2322

2423
"github.com/klauspost/compress/s2"
@@ -49,7 +48,7 @@ func PretendInit(clobbering bool) {
4948

5049
c := &compressor{}
5150
c.poolCompressor.New = func() interface{} {
52-
w := s2.NewWriter(ioutil.Discard, s2.WriterConcurrency(1))
51+
w := s2.NewWriter(io.Discard, s2.WriterConcurrency(1))
5352
return &writer{Writer: w, pool: &c.poolCompressor}
5453
}
5554
encoding.RegisterCompressor(c)

internal/s2/s2_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package s2
1717
import (
1818
"bytes"
1919
"context"
20-
"io/ioutil"
20+
"io"
2121
"net"
2222
"testing"
2323

@@ -54,7 +54,7 @@ func TestRegisteredCompression(t *testing.T) {
5454

5555
r, err := comp.Decompress(buf)
5656
require.NoError(t, err)
57-
expected, err := ioutil.ReadAll(r)
57+
expected, err := io.ReadAll(r)
5858
require.NoError(t, err)
5959

6060
assert.Equal(t, message, string(expected))

internal/snappy/snappy.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ package snappy
2424

2525
import (
2626
"io"
27-
"io/ioutil"
2827
"sync"
2928

3029
snappylib "github.com/golang/snappy"
@@ -55,7 +54,7 @@ func PretendInit(clobbering bool) {
5554

5655
c := &compressor{}
5756
c.poolCompressor.New = func() interface{} {
58-
w := snappylib.NewBufferedWriter(ioutil.Discard)
57+
w := snappylib.NewBufferedWriter(io.Discard)
5958
return &writer{Writer: w, pool: &c.poolCompressor}
6059
}
6160
encoding.RegisterCompressor(c)

internal/snappy/snappy_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package snappy
2121
import (
2222
"bytes"
2323
"context"
24-
"io/ioutil"
24+
"io"
2525
"net"
2626
"testing"
2727

@@ -58,7 +58,7 @@ func TestRegisteredCompression(t *testing.T) {
5858

5959
r, err := comp.Decompress(buf)
6060
require.NoError(t, err)
61-
expected, err := ioutil.ReadAll(r)
61+
expected, err := io.ReadAll(r)
6262
require.NoError(t, err)
6363

6464
assert.Equal(t, message, string(expected))

internal/zstd/zstd_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package zstd
2121
import (
2222
"bytes"
2323
"context"
24-
"io/ioutil"
24+
"io"
2525
"net"
2626
"testing"
2727

@@ -63,7 +63,7 @@ func TestRegisteredCompression(t *testing.T) {
6363

6464
r, err := comp.Decompress(buf)
6565
require.NoError(t, err)
66-
expected, err := ioutil.ReadAll(r)
66+
expected, err := io.ReadAll(r)
6767
require.NoError(t, err)
6868

6969
assert.Equal(t, message, string(expected))

0 commit comments

Comments
 (0)