Replace deprecated ioutil package
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
@@ -269,7 +269,7 @@ func (context *SignContext) GetTSA(sign_content []byte) (timestamp_response []by
|
||||
if err != nil || (code < 200 || code > 299) {
|
||||
if err == nil {
|
||||
defer resp.Body.Close()
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return nil, errors.New("non success response (" + strconv.Itoa(code) + "): " + string(body))
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func (context *SignContext) GetTSA(sign_content []byte) (timestamp_response []by
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
timestamp_response_body, err := ioutil.ReadAll(resp.Body)
|
||||
timestamp_response_body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read response: %w", err)
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import (
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -27,7 +27,7 @@ func embedOCSPRevocationStatus(cert, issuer *x509.Certificate, i *revocation.Inf
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -49,7 +49,7 @@ func embedCRLRevocationStatus(cert, issuer *x509.Certificate, i *revocation.Info
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/asn1"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"time"
|
||||
@@ -146,7 +145,7 @@ func Reader(file io.ReaderAt, size int64) (apiResp *Response, err error) {
|
||||
// This content will be hashed with the corresponding algorithm to
|
||||
// verify the signature.
|
||||
|
||||
content, err := ioutil.ReadAll(io.NewSectionReader(file, v.Key("ByteRange").Index(i-1).Int64(), v.Key("ByteRange").Index(i).Int64()))
|
||||
content, err := io.ReadAll(io.NewSectionReader(file, v.Key("ByteRange").Index(i-1).Int64(), v.Key("ByteRange").Index(i).Int64()))
|
||||
if err != nil {
|
||||
apiResp.Error = fmt.Sprintln("Failed to get ByteRange:", i, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user