diff --git a/cmd/btcctl/config.go b/cmd/btcctl/config.go index f6ca8846..44d28c60 100644 --- a/cmd/btcctl/config.go +++ b/cmd/btcctl/config.go @@ -6,7 +6,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "net" "os" "path/filepath" @@ -322,7 +322,7 @@ func createDefaultConfigFile(destinationPath, serverConfigPath string) error { return err } defer serverConfigFile.Close() - content, err := ioutil.ReadAll(serverConfigFile) + content, err := io.ReadAll(serverConfigFile) if err != nil { return err } diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 9a9c2bb8..f26d2c56 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -15,7 +15,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math" "net" "net/http" @@ -852,7 +851,7 @@ func (c *Client) handleSendPostMessage(jReq *jsonRequest) { } // Read the raw bytes and close the response. - respBytes, err := ioutil.ReadAll(httpResponse.Body) + respBytes, err := io.ReadAll(httpResponse.Body) httpResponse.Body.Close() if err != nil { err = fmt.Errorf("error reading json reply: %v", err) diff --git a/rpcserver.go b/rpcserver.go index 363661d7..e9fec435 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -15,7 +15,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "math/big" "math/rand" "net" @@ -4335,7 +4334,7 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin } // Read and close the JSON-RPC request body from the caller. - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() if err != nil { errCode := http.StatusBadRequest diff --git a/wire/bench_test.go b/wire/bench_test.go index 2f63fa30..266aded2 100644 --- a/wire/bench_test.go +++ b/wire/bench_test.go @@ -9,7 +9,6 @@ import ( "compress/bzip2" "fmt" "io" - "io/ioutil" "net" "os" "testing" @@ -592,7 +591,7 @@ func BenchmarkDeserializeTxLarge(b *testing.B) { b.Fatalf("Failed to read transaction data: %v", err) } defer fi.Close() - buf, err := ioutil.ReadAll(bzip2.NewReader(fi)) + buf, err := io.ReadAll(bzip2.NewReader(fi)) if err != nil { b.Fatalf("Failed to read transaction data: %v", err) } @@ -713,7 +712,7 @@ func BenchmarkSerializeTxLarge(b *testing.B) { b.Fatalf("Failed to read transaction data: %v", err) } defer fi.Close() - buf, err := ioutil.ReadAll(bzip2.NewReader(fi)) + buf, err := io.ReadAll(bzip2.NewReader(fi)) if err != nil { b.Fatalf("Failed to read transaction data: %v", err) }