mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-05 04:55:18 +00:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user