Skip to content

Commit c74b4e7

Browse files
committed
httpclient: use os.ReadFile instead of deprecated ioutil.ReadFile
1 parent fc385a9 commit c74b4e7

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

httpclient/httpclient.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"crypto/tls"
55
"crypto/x509"
66
"fmt"
7-
"io/ioutil"
87
"log"
98
"net/http"
109
"net/url"
@@ -32,7 +31,7 @@ func GetTLSHttpClientByTLSFlag(tlsFlag string, tlsInsecure bool, baseUrl *url.UR
3231
// Append user specified certificate(s)
3332
if tlsFlag != "self-signed" && tlsFlag != "" {
3433
usrCert := strings.Split(tlsFlag, ",")[0]
35-
certBytes, err := ioutil.ReadFile(usrCert)
34+
certBytes, err := os.ReadFile(usrCert)
3635
if err != nil {
3736
return nil, false, fmt.Errorf("reading user specified certificate %s: %v", usrCert, err)
3837
}
@@ -44,7 +43,7 @@ func GetTLSHttpClientByTLSFlag(tlsFlag string, tlsInsecure bool, baseUrl *url.UR
4443
if _, err := os.Stat(certPath); !os.IsNotExist(err) {
4544
foundMatchingCertificate = true
4645
log.Printf("Using certificate %s", certPath)
47-
certBytes, err := ioutil.ReadFile(certPath)
46+
certBytes, err := os.ReadFile(certPath)
4847
if err != nil {
4948
return nil, false, fmt.Errorf("reading certificate %s: %v", certPath, err)
5049
}

0 commit comments

Comments
 (0)