From c7f81d314230c11ab3d5333340b652336bb03302 Mon Sep 17 00:00:00 2001 From: erik Date: Wed, 14 Jun 2023 11:40:27 +0200 Subject: [PATCH] multi: replace ioutil.Discard --- lnwire/onion_error.go | 3 +-- tlv/stream.go | 3 +-- watchtower/tlv_bench_test.go | 5 ++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lnwire/onion_error.go b/lnwire/onion_error.go index 8b7fc733b..66db6a9f5 100644 --- a/lnwire/onion_error.go +++ b/lnwire/onion_error.go @@ -7,7 +7,6 @@ import ( "encoding/binary" "fmt" "io" - "io/ioutil" "github.com/davecgh/go-spew/spew" "github.com/go-errors/errors" @@ -1304,7 +1303,7 @@ func DecodeFailure(r io.Reader, pver uint32) (FailureMessage, error) { return nil, fmt.Errorf("unable to read pad len: %w", err) } - if _, err := io.CopyN(ioutil.Discard, r, int64(padLength)); err != nil { + if _, err := io.CopyN(io.Discard, r, int64(padLength)); err != nil { return nil, fmt.Errorf("unable to read padding %w", err) } diff --git a/tlv/stream.go b/tlv/stream.go index 3d353ad22..70fade22d 100644 --- a/tlv/stream.go +++ b/tlv/stream.go @@ -4,7 +4,6 @@ import ( "bytes" "errors" "io" - "io/ioutil" "math" ) @@ -262,7 +261,7 @@ func (s *Stream) decode(r io.Reader, parsedTypes TypeMap, p2p bool) (TypeMap, // If the caller provided an initialized TypeMap, record // the encoded bytes. var b *bytes.Buffer - writer := ioutil.Discard + writer := io.Discard if parsedTypes != nil { b = bytes.NewBuffer(make([]byte, 0, length)) writer = b diff --git a/watchtower/tlv_bench_test.go b/watchtower/tlv_bench_test.go index 5ffabde08..e6d8decd7 100644 --- a/watchtower/tlv_bench_test.go +++ b/watchtower/tlv_bench_test.go @@ -3,7 +3,6 @@ package watchtower_test import ( "bytes" "io" - "io/ioutil" "testing" "github.com/lightningnetwork/lnd/lnwallet/chainfee" @@ -104,7 +103,7 @@ func BenchmarkEncodeCreateSession(t *testing.B) { var err error for i := 0; i < t.N; i++ { - err = m.Encode(ioutil.Discard, 0) + err = m.Encode(io.Discard, 0) } require.NoError(t, err) } @@ -118,7 +117,7 @@ func BenchmarkEncodeCreateSessionTLV(t *testing.B) { var err error for i := 0; i < t.N; i++ { - err = m.Encode(ioutil.Discard) + err = m.Encode(io.Discard) } require.NoError(t, err) }