refactor: remove use of tmos "github.com/tendermint/tendermint/libs/os" (#13113)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user