libs/os: remove unused aliases, add test cases (#5654)

Remove unused ReadFile (unused) and
WriteFile (almost unused, alias of ioutil.WriteFile).

Add testcases for Must{Read,Write}File.
This commit is contained in:
Alessio Treglia
2020-11-13 10:59:45 +00:00
committed by GitHub
parent 95cff1efb4
commit 8bd3d5105f
9 changed files with 71 additions and 85 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/tendermint/tendermint/crypto"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmjson "github.com/tendermint/tendermint/libs/json"
tmos "github.com/tendermint/tendermint/libs/os"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
)
@@ -52,7 +51,8 @@ func (genDoc *GenesisDoc) SaveAs(file string) error {
if err != nil {
return err
}
return tmos.WriteFile(file, genDocBytes, 0644)
return ioutil.WriteFile(file, genDocBytes, 0644) // nolint:gosec
}
// ValidatorHash returns the hash of the validator set contained in the GenesisDoc