Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop using ioutil #1066

Merged
merged 3 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/legacy/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package legacy
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"time"

"github.com/cosmos/cosmos-sdk/x/authz"
Expand Down Expand Up @@ -53,7 +53,7 @@ $ secretd migrate /path/to/genesis.json --chain-id=secret-4 --genesis-time=2019-

importGenesis := args[0]

jsonBlob, err := ioutil.ReadFile(importGenesis)
jsonBlob, err := os.ReadFile(importGenesis)
if err != nil {
return errors.Wrap(err, "failed to read provided genesis file")
}
Expand Down
22 changes: 11 additions & 11 deletions cmd/secretd/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ blockchain. Writes the certificate in DER format to ~/attestation_cert
// Load consensus_seed_exchange_pubkey
cert := []byte(nil)
if len(args) >= 1 {
cert, err = ioutil.ReadFile(args[0])
cert, err = os.ReadFile(args[0])
if err != nil {
return err
}
} else {
cert, err = ioutil.ReadFile(filepath.Join(userHome, reg.NodeExchMasterCertPath))
cert, err = os.ReadFile(filepath.Join(userHome, reg.NodeExchMasterCertPath))
if err != nil {
return err
}
Expand All @@ -187,12 +187,12 @@ blockchain. Writes the certificate in DER format to ~/attestation_cert

// Load consensus_io_exchange_pubkey
if len(args) == 2 {
cert, err = ioutil.ReadFile(args[1])
cert, err = os.ReadFile(args[1])
if err != nil {
return err
}
} else {
cert, err = ioutil.ReadFile(filepath.Join(userHome, reg.IoExchMasterCertPath))
cert, err = os.ReadFile(filepath.Join(userHome, reg.IoExchMasterCertPath))
if err != nil {
return err
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func ParseCert() *cobra.Command {
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
// parse coins trying to be sent
cert, err := ioutil.ReadFile(args[0])
cert, err := os.ReadFile(args[0])
if err != nil {
return err
}
Expand All @@ -254,7 +254,7 @@ func ConfigureSecret() *cobra.Command {
"seed that was written on-chain",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
cert, err := ioutil.ReadFile(args[0])
cert, err := os.ReadFile(args[0])
if err != nil {
return err
}
Expand Down Expand Up @@ -289,7 +289,7 @@ func ConfigureSecret() *cobra.Command {

seedFilePath := filepath.Join(nodeDir, reg.SecretNodeSeedConfig)

err = ioutil.WriteFile(seedFilePath, cfgBytes, 0o664)
err = os.WriteFile(seedFilePath, cfgBytes, 0o664)
if err != nil {
return err
}
Expand Down Expand Up @@ -449,7 +449,7 @@ Please report any issues with this command
}

// read the attestation certificate that we just created
cert, err := ioutil.ReadFile(sgxAttestationCert)
cert, err := os.ReadFile(sgxAttestationCert)
if err != nil {
_ = os.Remove(sgxAttestationCert)
return err
Expand Down Expand Up @@ -494,7 +494,7 @@ Please report any issues with this command
resp, err := http.Post(fmt.Sprintf(`%s`, regUrl), "application/json", bytes.NewBuffer(data))
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
Expand Down Expand Up @@ -559,7 +559,7 @@ Please report any issues with this command
// write seed to file - if file doesn't exist, write it. If it does, delete the existing one and create this
_, err = os.Stat(seedCfgFile)
if os.IsNotExist(err) {
err = ioutil.WriteFile(seedCfgFile, cfgBytes, 0o644)
err = os.WriteFile(seedCfgFile, cfgBytes, 0o644)
if err != nil {
return err
}
Expand All @@ -569,7 +569,7 @@ Please report any issues with this command
return fmt.Errorf("failed to modify file '%s': %w", seedCfgFile, err)
}

err = ioutil.WriteFile(seedCfgFile, cfgBytes, 0o644)
err = os.WriteFile(seedCfgFile, cfgBytes, 0o644)
if err != nil {
return fmt.Errorf("failed to create file '%s': %w", seedCfgFile, err)
}
Expand Down
3 changes: 1 addition & 2 deletions go-cosmwasm/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"

wasm "github.com/enigmampc/SecretNetwork/go-cosmwasm"
Expand All @@ -12,7 +11,7 @@ import (
func main() {
file := os.Args[1]
fmt.Printf("Running %s...\n", file)
bz, err := ioutil.ReadFile(file)
bz, err := os.ReadFile(file)
if err != nil {
panic(err)
}
Expand Down
Loading