multi: replace ioutil.Discard

This commit is contained in:
erik 2023-06-14 11:40:27 +02:00 committed by ErikEk
parent 789c6bac8c
commit c7f81d3142
3 changed files with 4 additions and 7 deletions

View File

@ -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)
}

View File

@ -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

View File

@ -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)
}