refactor: remove use of tmos "github.com/tendermint/tendermint/libs/os" (#13113)
This commit is contained in:
@@ -2,11 +2,11 @@ package network
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
tmos "github.com/tendermint/tendermint/libs/os"
|
||||
"github.com/tendermint/tendermint/node"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
pvm "github.com/tendermint/tendermint/privval"
|
||||
@@ -194,13 +194,11 @@ func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalance
|
||||
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