do not use ioutil (#9206)

This commit is contained in:
Jacob Gadikian
2022-08-11 01:35:14 +07:00
committed by GitHub
parent 152a2fa5c9
commit a6dde14ec4
59 changed files with 165 additions and 200 deletions

View File

@@ -2,7 +2,6 @@ package internal
import (
"fmt"
"io/ioutil"
"os"
"testing"
"time"
@@ -187,7 +186,7 @@ func cleanup(cfg TestHarnessConfig) {
}
func makeTempFile(name, content string) string {
tempFile, err := ioutil.TempFile("", fmt.Sprintf("%s-*", name))
tempFile, err := os.CreateTemp("", fmt.Sprintf("%s-*", name))
if err != nil {
panic(err)
}

View File

@@ -3,7 +3,6 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"time"
@@ -136,7 +135,7 @@ func extractKey(tmhome, outputPath string) {
stateFile := filepath.Join(internal.ExpandPath(tmhome), "data", "priv_validator_state.json")
fpv := privval.LoadFilePV(keyFile, stateFile)
pkb := []byte(fpv.Key.PrivKey.(ed25519.PrivKey))
if err := ioutil.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0600); err != nil {
if err := os.WriteFile(internal.ExpandPath(outputPath), pkb[:32], 0600); err != nil {
logger.Info("Failed to write private key", "output", outputPath, "err", err)
os.Exit(1)
}