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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -322,7 +322,7 @@ func createDefaultConfigFile(destinationPath, serverConfigPath string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer serverConfigFile.Close()
|
defer serverConfigFile.Close()
|
||||||
content, err := ioutil.ReadAll(serverConfigFile)
|
content, err := io.ReadAll(serverConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math"
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -852,7 +851,7 @@ func (c *Client) handleSendPostMessage(jReq *jsonRequest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the raw bytes and close the response.
|
// Read the raw bytes and close the response.
|
||||||
respBytes, err := ioutil.ReadAll(httpResponse.Body)
|
respBytes, err := io.ReadAll(httpResponse.Body)
|
||||||
httpResponse.Body.Close()
|
httpResponse.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("error reading json reply: %v", err)
|
err = fmt.Errorf("error reading json reply: %v", err)
|
||||||
|
|
|
@ -15,7 +15,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"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.
|
// 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()
|
r.Body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errCode := http.StatusBadRequest
|
errCode := http.StatusBadRequest
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"compress/bzip2"
|
"compress/bzip2"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -592,7 +591,7 @@ func BenchmarkDeserializeTxLarge(b *testing.B) {
|
||||||
b.Fatalf("Failed to read transaction data: %v", err)
|
b.Fatalf("Failed to read transaction data: %v", err)
|
||||||
}
|
}
|
||||||
defer fi.Close()
|
defer fi.Close()
|
||||||
buf, err := ioutil.ReadAll(bzip2.NewReader(fi))
|
buf, err := io.ReadAll(bzip2.NewReader(fi))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Failed to read transaction data: %v", err)
|
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)
|
b.Fatalf("Failed to read transaction data: %v", err)
|
||||||
}
|
}
|
||||||
defer fi.Close()
|
defer fi.Close()
|
||||||
buf, err := ioutil.ReadAll(bzip2.NewReader(fi))
|
buf, err := io.ReadAll(bzip2.NewReader(fi))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Failed to read transaction data: %v", err)
|
b.Fatalf("Failed to read transaction data: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue