Skip to content

Commit 619c8f4

Browse files
committed
multi: repleace ioutil.ReadAll
1 parent 8ce3622 commit 619c8f4

File tree

8 files changed

+12
-16
lines changed

8 files changed

+12
-16
lines changed

chainreg/chainregistry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"encoding/json"
66
"errors"
77
"fmt"
8-
"io/ioutil"
8+
"io"
99
"net"
1010
"net/url"
1111
"os"
@@ -547,7 +547,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
547547
if err != nil {
548548
return nil, nil, err
549549
}
550-
rpcCert, err = ioutil.ReadAll(certFile)
550+
rpcCert, err = io.ReadAll(certFile)
551551
if err != nil {
552552
return nil, nil, err
553553
}

channeldb/migration/lnwire21/announcement_signatures.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package lnwire
22

33
import (
44
"io"
5-
"io/ioutil"
65
)
76

87
// AnnounceSignatures is a direct message between two endpoints of a
@@ -66,7 +65,7 @@ func (a *AnnounceSignatures) Decode(r io.Reader, pver uint32) error {
6665
// we'll collect the remainder into the ExtraOpaqueData field. If there
6766
// aren't any bytes, then we'll snip off the slice to avoid carrying
6867
// around excess capacity.
69-
a.ExtraOpaqueData, err = ioutil.ReadAll(r)
68+
a.ExtraOpaqueData, err = io.ReadAll(r)
7069
if err != nil {
7170
return err
7271
}

channeldb/migration/lnwire21/channel_announcement.go

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

87
"github.com/btcsuite/btcd/chaincfg/chainhash"
98
)
@@ -89,7 +88,7 @@ func (a *ChannelAnnouncement) Decode(r io.Reader, pver uint32) error {
8988
// we'll collect the remainder into the ExtraOpaqueData field. If there
9089
// aren't any bytes, then we'll snip off the slice to avoid carrying
9190
// around excess capacity.
92-
a.ExtraOpaqueData, err = ioutil.ReadAll(r)
91+
a.ExtraOpaqueData, err = io.ReadAll(r)
9392
if err != nil {
9493
return err
9594
}

channeldb/migration/lnwire21/channel_update.go

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

98
"github.com/btcsuite/btcd/chaincfg/chainhash"
109
)
@@ -160,7 +159,7 @@ func (a *ChannelUpdate) Decode(r io.Reader, pver uint32) error {
160159
// we'll collect the remainder into the ExtraOpaqueData field. If there
161160
// aren't any bytes, then we'll snip off the slice to avoid carrying
162161
// around excess capacity.
163-
a.ExtraOpaqueData, err = ioutil.ReadAll(r)
162+
a.ExtraOpaqueData, err = io.ReadAll(r)
164163
if err != nil {
165164
return err
166165
}

channeldb/migration/lnwire21/node_announcement.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"image/color"
77
"io"
8-
"io/ioutil"
98
"net"
109
"unicode/utf8"
1110
)
@@ -127,7 +126,7 @@ func (a *NodeAnnouncement) Decode(r io.Reader, pver uint32) error {
127126
// we'll collect the remainder into the ExtraOpaqueData field. If there
128127
// aren't any bytes, then we'll snip off the slice to avoid carrying
129128
// around excess capacity.
130-
a.ExtraOpaqueData, err = ioutil.ReadAll(r)
129+
a.ExtraOpaqueData, err = io.ReadAll(r)
131130
if err != nil {
132131
return err
133132
}

cmd/lncli/cmd_payments.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"encoding/hex"
88
"errors"
99
"fmt"
10-
"io/ioutil"
10+
"io"
1111
"os"
1212
"runtime"
1313
"strconv"
@@ -987,7 +987,7 @@ func sendToRoute(ctx *cli.Context) error {
987987
// The user is signalling that we should read stdin in order to parse
988988
// the set of target routes.
989989
case args.Present() && args.First() == "-":
990-
b, err := ioutil.ReadAll(os.Stdin)
990+
b, err := io.ReadAll(os.Stdin)
991991
if err != nil {
992992
return err
993993
}

config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"encoding/hex"
99
"errors"
1010
"fmt"
11+
"io"
1112
"io/ioutil"
1213
"net"
1314
"os"
@@ -2006,7 +2007,7 @@ func extractBtcdRPCParams(btcdConfigPath string) (string, string, error) {
20062007

20072008
// With the file open extract the contents of the configuration file so
20082009
// we can attempt to locate the RPC credentials.
2009-
configContents, err := ioutil.ReadAll(btcdConfigFile)
2010+
configContents, err := io.ReadAll(btcdConfigFile)
20102011
if err != nil {
20112012
return "", "", err
20122013
}
@@ -2056,7 +2057,7 @@ func extractBitcoindRPCParams(networkName, bitcoindDataDir, bitcoindConfigPath,
20562057

20572058
// With the file open extract the contents of the configuration file so
20582059
// we can attempt to locate the RPC credentials.
2059-
configContents, err := ioutil.ReadAll(bitcoindConfigFile)
2060+
configContents, err := io.ReadAll(bitcoindConfigFile)
20602061
if err != nil {
20612062
return "", "", "", "", err
20622063
}

contractcourt/htlc_incoming_contest_resolver_test.go

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

98
sphinx "github.com/lightningnetwork/lightning-onion"
@@ -291,7 +290,7 @@ type mockOnionProcessor struct {
291290
func (o *mockOnionProcessor) ReconstructHopIterator(r io.Reader, rHash []byte,
292291
_ hop.ReconstructBlindingInfo) (hop.Iterator, error) {
293292

294-
data, err := ioutil.ReadAll(r)
293+
data, err := io.ReadAll(r)
295294
if err != nil {
296295
return nil, err
297296
}

0 commit comments

Comments
 (0)