mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-12 10:30:49 +01:00
Merge pull request #2336 from argentpapa/master
multi: remove deprecated io/ioutil
This commit is contained in:
commit
6afce8d608
4 changed files with 6 additions and 9 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue