refactor: remove use of tmos "github.com/tendermint/tendermint/libs/os" (#13113)

This commit is contained in:
Facundo Medica
2022-09-01 21:00:50 +00:00
committed by GitHub
parent bf8f015797
commit db8714da9e
10 changed files with 34 additions and 36 deletions
+3 -6
View File
@@ -13,7 +13,6 @@ import (
"cosmossdk.io/math"
"github.com/spf13/cobra"
tmconfig "github.com/tendermint/tendermint/config"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
@@ -469,13 +468,11 @@ func calculateIP(ip string, i int) (string, error) {
func writeFile(name string, dir string, contents []byte) error {
file := filepath.Join(dir, name)
err := tmos.EnsureDir(dir, 0o755)
if err != nil {
return err
if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("could not create directory %q: %w", dir, err)
}
err = os.WriteFile(file, contents, 0o644) //nolint: gosec
if err != nil {
if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec
return err
}