Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Apr 20, 2024
1 parent 8d98448 commit 28abd7c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions testutil/network/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package network

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"time"
Expand All @@ -15,6 +14,7 @@ import (
tmtypes "github.com/cometbft/cometbft/types"
tmtime "github.com/cometbft/cometbft/types/time"

tmos "github.com/cometbft/cometbft/libs/os"
"github.com/cosmos/cosmos-sdk/server/api"
servergrpc "github.com/cosmos/cosmos-sdk/server/grpc"
srvtypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down Expand Up @@ -227,13 +227,16 @@ func initGenFiles(cfg Config, genAccounts []authtypes.GenesisAccount, genBalance
}

func writeFile(name string, dir string, contents []byte) error {
file := filepath.Join(dir, name)
writePath := filepath.Join(dir) //nolint:gocritic
file := filepath.Join(writePath, name)

if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("could not create directory %q: %w", dir, err)
err := tmos.EnsureDir(writePath, 0o755) // #nosec G301
if err != nil {
return err
}

if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec
err = os.WriteFile(file, contents, 0600)
if err != nil {
return err
}

Expand Down

0 comments on commit 28abd7c

Please sign in to comment.