Skip to content

Commit c7f81d3

Browse files
committed
multi: replace ioutil.Discard
1 parent 789c6ba commit c7f81d3

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

lnwire/onion_error.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"encoding/binary"
88
"fmt"
99
"io"
10-
"io/ioutil"
1110

1211
"github.com/davecgh/go-spew/spew"
1312
"github.com/go-errors/errors"
@@ -1304,7 +1303,7 @@ func DecodeFailure(r io.Reader, pver uint32) (FailureMessage, error) {
13041303
return nil, fmt.Errorf("unable to read pad len: %w", err)
13051304
}
13061305

1307-
if _, err := io.CopyN(ioutil.Discard, r, int64(padLength)); err != nil {
1306+
if _, err := io.CopyN(io.Discard, r, int64(padLength)); err != nil {
13081307
return nil, fmt.Errorf("unable to read padding %w", err)
13091308
}
13101309

tlv/stream.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"errors"
66
"io"
7-
"io/ioutil"
87
"math"
98
)
109

@@ -262,7 +261,7 @@ func (s *Stream) decode(r io.Reader, parsedTypes TypeMap, p2p bool) (TypeMap,
262261
// If the caller provided an initialized TypeMap, record
263262
// the encoded bytes.
264263
var b *bytes.Buffer
265-
writer := ioutil.Discard
264+
writer := io.Discard
266265
if parsedTypes != nil {
267266
b = bytes.NewBuffer(make([]byte, 0, length))
268267
writer = b

watchtower/tlv_bench_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package watchtower_test
33
import (
44
"bytes"
55
"io"
6-
"io/ioutil"
76
"testing"
87

98
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
@@ -104,7 +103,7 @@ func BenchmarkEncodeCreateSession(t *testing.B) {
104103

105104
var err error
106105
for i := 0; i < t.N; i++ {
107-
err = m.Encode(ioutil.Discard, 0)
106+
err = m.Encode(io.Discard, 0)
108107
}
109108
require.NoError(t, err)
110109
}
@@ -118,7 +117,7 @@ func BenchmarkEncodeCreateSessionTLV(t *testing.B) {
118117

119118
var err error
120119
for i := 0; i < t.N; i++ {
121-
err = m.Encode(ioutil.Discard)
120+
err = m.Encode(io.Discard)
122121
}
123122
require.NoError(t, err)
124123
}

0 commit comments

Comments
 (0)