Merge pull request #2336 from argentpapa/master

multi: remove deprecated io/ioutil
This commit is contained in:
Oliver Gugger 2025-03-10 09:34:34 -06:00 committed by GitHub
commit 6afce8d608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 9 deletions

View file

@ -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
}

View file

@ -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)

View file

@ -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

View file

@ -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)
}