all: replace uses of ioutil with io and os (#24869)

This commit is contained in:
Håvard Anda Estensen
2022-05-16 11:59:35 +02:00
committed by GitHub
parent 330e53fbb9
commit 07508ac0e9
97 changed files with 203 additions and 257 deletions
+5 -5
View File
@@ -26,7 +26,7 @@ import (
"flag"
"fmt"
"html/template"
"io/ioutil"
"io"
"math"
"math/big"
"net/http"
@@ -157,14 +157,14 @@ func main() {
}
}
// Load up the account key and decrypt its password
blob, err := ioutil.ReadFile(*accPassFlag)
blob, err := os.ReadFile(*accPassFlag)
if err != nil {
log.Crit("Failed to read account password contents", "file", *accPassFlag, "err", err)
}
pass := strings.TrimSuffix(string(blob), "\n")
ks := keystore.NewKeyStore(filepath.Join(os.Getenv("HOME"), ".faucet", "keys"), keystore.StandardScryptN, keystore.StandardScryptP)
if blob, err = ioutil.ReadFile(*accJSONFlag); err != nil {
if blob, err = os.ReadFile(*accJSONFlag); err != nil {
log.Crit("Failed to read account key contents", "file", *accJSONFlag, "err", err)
}
acc, err := ks.Import(blob, pass, pass)
@@ -727,7 +727,7 @@ func authTwitter(url string, tokenV1, tokenV2 string) (string, string, string, c
}
username := parts[len(parts)-3]
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return "", "", "", common.Address{}, err
}
@@ -853,7 +853,7 @@ func authFacebook(url string) (string, string, common.Address, error) {
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return "", "", common.Address{}, err
}