migrate away from deprecated ioutil APIs (#7175)

Co-authored-by: Callum Waters <cmwaters19@gmail.com>
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
Sharad Chand
2021-10-28 23:19:07 +05:45
committed by GitHub
parent 6108d0a9b5
commit 8441b3715a
58 changed files with 158 additions and 192 deletions

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"time"
"github.com/tendermint/tendermint/crypto"
@@ -51,7 +51,7 @@ func (genDoc *GenesisDoc) SaveAs(file string) error {
return err
}
return ioutil.WriteFile(file, genDocBytes, 0644) // nolint:gosec
return os.WriteFile(file, genDocBytes, 0644) // nolint:gosec
}
// ValidatorHash returns the hash of the validator set contained in the GenesisDoc
@@ -125,7 +125,7 @@ func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error) {
// GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.
func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error) {
jsonBlob, err := ioutil.ReadFile(genDocFile)
jsonBlob, err := os.ReadFile(genDocFile)
if err != nil {
return nil, fmt.Errorf("couldn't read GenesisDoc file: %w", err)
}