Stop using deprecated ioutil package.

This commit is contained in:
Joachim Bauch
2022-04-05 12:48:27 +02:00
parent 9c2df744c1
commit 81a52389aa
12 changed files with 48 additions and 49 deletions
+3 -3
View File
@@ -26,7 +26,7 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"os"
"testing"
"time"
@@ -59,7 +59,7 @@ func newProxyServerForTest(t *testing.T) (*ProxyServer, *rsa.PrivateKey, func())
Type: "RSA PRIVATE KEY",
Bytes: x509.MarshalPKCS1PrivateKey(key),
}
privkey, err := ioutil.TempFile(tempdir, "privkey*.pem")
privkey, err := os.CreateTemp(tempdir, "privkey*.pem")
if err != nil {
t.Fatalf("could not create temporary file for private key: %s", err)
}
@@ -75,7 +75,7 @@ func newProxyServerForTest(t *testing.T) (*ProxyServer, *rsa.PrivateKey, func())
Type: "RSA PUBLIC KEY",
Bytes: pubData,
}
pubkey, err := ioutil.TempFile(tempdir, "pubkey*.pem")
pubkey, err := os.CreateTemp(tempdir, "pubkey*.pem")
if err != nil {
t.Fatalf("could not create temporary file for public key: %s", err)
}
+2 -2
View File
@@ -23,8 +23,8 @@ package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"sort"
"sync/atomic"
@@ -73,7 +73,7 @@ func (t *tokensStatic) load(config *goconf.ConfigFile, ignoreErrors bool) error
continue
}
keyData, err := ioutil.ReadFile(filename)
keyData, err := os.ReadFile(filename)
if err != nil {
if !ignoreErrors {
return fmt.Errorf("Could not read public key from %s: %s", filename, err)