Skip to content

Commit

Permalink
Stop using deprecated ioutil package
Browse files Browse the repository at this point in the history
  • Loading branch information
sink772 committed Dec 19, 2023
1 parent 7501a9d commit b1c5358
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions icon/chainscore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package icon
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"math/big"
"os"

Expand Down Expand Up @@ -1139,7 +1139,7 @@ func (s *chainScore) loadIconConfig() *config {
s.log.Infof("Failed to open configuration file %+v. Use default config", err)
return iconConfig
}
bs, err := ioutil.ReadAll(f)
bs, err := io.ReadAll(f)
if err != nil {
s.log.Infof("Failed to read configuration file %+v. Use default config", err)
return iconConfig
Expand Down Expand Up @@ -1195,7 +1195,7 @@ func (s *chainScore) Install(param []byte) error {
revision = icmodule.Revision1

// prepare Governance SCORE
governance, err := ioutil.ReadFile("icon_governance.zip")
governance, err := os.ReadFile("icon_governance.zip")
if err != nil || len(governance) == 0 {
return transaction.InvalidGenesisError.Wrap(err, "FailOnGovernance")
}
Expand Down Expand Up @@ -1235,7 +1235,7 @@ func (s *chainScore) Install(param []byte) error {
}
systemConfig = state.SysConfigScorePackageValidator
revision = icmodule.Revision1
governance, err := ioutil.ReadFile("icon_governance.zip")
governance, err := os.ReadFile("icon_governance.zip")
if err != nil || len(governance) == 0 {
return transaction.InvalidGenesisError.Wrap(err, "FailOnGovernance")
}
Expand Down
3 changes: 1 addition & 2 deletions icon/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package icon

import (
"encoding/json"
"io/ioutil"
"math/big"
"os"
"path"
Expand Down Expand Up @@ -282,7 +281,7 @@ func (p *platform) SetBlockV1Proof(root []byte, size int64, votes *blockv0.Block
return err
}
file := path.Join(p.base, BlockV1ProofFile)
return ioutil.WriteFile(file, bs, os.FileMode(0500))
return os.WriteFile(file, bs, os.FileMode(0500))
}

func NewPlatform(base string, cid int) (base.Platform, error) {
Expand Down

0 comments on commit b1c5358

Please sign in to comment.